1{ lib, ... }:
2{
3 name = "ipget";
4 meta.maintainers = with lib.maintainers; [
5 Luflosi
6 ];
7
8 nodes.machine =
9 { config, pkgs, ... }:
10 {
11 services.kubo.enable = true;
12 environment.systemPackages = with pkgs; [ ipget ];
13 };
14
15 testScript = ''
16 start_all()
17
18 with subtest("Add file to IPFS"):
19 ipfs_hash = machine.succeed(
20 "echo -n fnord | ipfs add --quieter"
21 )
22
23 with subtest("Download the file with ipget"):
24 machine.succeed(f"ipget --output file.txt /ipfs/{ipfs_hash}")
25 contents = machine.succeed("cat file.txt")
26 assert contents == "fnord", f"Unexpected file contents: {contents}"
27 '';
28}