1{ lib, ...} : {
2 name = "kubo-fuse";
3 meta = with lib.maintainers; {
4 maintainers = [ mguentner Luflosi ];
5 };
6
7 nodes.machine = { config, ... }: {
8 services.kubo = {
9 enable = true;
10 autoMount = true;
11 };
12 users.users.alice = {
13 isNormalUser = true;
14 extraGroups = [ config.services.kubo.group ];
15 };
16 users.users.bob = {
17 isNormalUser = true;
18 };
19 };
20
21 testScript = ''
22 start_all()
23
24 with subtest("FUSE mountpoint"):
25 machine.fail("echo a | su bob -l -c 'ipfs add --quieter'")
26 # The FUSE mount functionality is broken as of v0.13.0 and v0.17.0.
27 # See https://github.com/ipfs/kubo/issues/9044.
28 # Workaround: using CID Version 1 avoids that.
29 ipfs_hash = machine.succeed(
30 "echo fnord3 | su alice -l -c 'ipfs add --quieter --cid-version=1'"
31 ).strip()
32
33 machine.succeed(f"cat /ipfs/{ipfs_hash} | grep fnord3")
34
35 with subtest("Unmounting of /ipns and /ipfs"):
36 # Force Kubo to crash and wait for it to restart
37 machine.systemctl("kill --signal=SIGKILL ipfs.service")
38 machine.wait_for_unit("ipfs.service", timeout = 30)
39
40 machine.succeed(f"cat /ipfs/{ipfs_hash} | grep fnord3")
41 '';
42}