3 meta = with lib.maintainers; {
4 maintainers = [ mguentner Luflosi ];
7 nodes.machine = { config, ... }: {
10 # Also will add a unix domain socket socket API address, see module.
11 startWhenNeeded = true;
12 settings.Addresses.API = "/ip4/127.0.0.1/tcp/2324";
13 dataDir = "/mnt/ipfs";
17 extraGroups = [ config.services.kubo.group ];
24 with subtest("Automatic socket activation"):
25 ipfs_hash = machine.succeed(
26 "echo fnord0 | su alice -l -c 'ipfs add --quieter'"
28 machine.succeed(f"ipfs cat /ipfs/{ipfs_hash.strip()} | grep fnord0")
30 machine.stop_job("ipfs")
32 with subtest("IPv4 socket activation"):
33 machine.succeed("ipfs --api /ip4/127.0.0.1/tcp/2324 id")
34 ipfs_hash = machine.succeed(
35 "echo fnord | ipfs --api /ip4/127.0.0.1/tcp/2324 add --quieter"
37 machine.succeed(f"ipfs cat /ipfs/{ipfs_hash.strip()} | grep fnord")
39 machine.stop_job("ipfs")
41 with subtest("Unix domain socket activation"):
42 ipfs_hash = machine.succeed(
43 "echo fnord2 | ipfs --api /unix/run/ipfs.sock add --quieter"
46 f"ipfs --api /unix/run/ipfs.sock cat /ipfs/{ipfs_hash.strip()} | grep fnord2"
49 machine.stop_job("ipfs")
51 with subtest("Socket activation for the Gateway"):
53 f"curl 'http://127.0.0.1:8080/ipfs/{ipfs_hash.strip()}' | grep fnord2"
56 with subtest("Setting dataDir works properly with the hardened systemd unit"):
57 machine.succeed("test -e /mnt/ipfs/config")
58 machine.succeed("test ! -e /var/lib/ipfs/")