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