···161161 autoMount = lib.mkOption {
162162 type = lib.types.bool;
163163 default = false;
164164- description = "Whether Kubo should try to mount /ipfs and /ipns at startup.";
164164+ description = "Whether Kubo should try to mount /ipfs, /ipns and /mfs at startup.";
165165 };
166166167167 autoMigrate = lib.mkOption {
···236236 default = "/ipns";
237237 description = "Where to mount the IPNS namespace to";
238238 };
239239+240240+ Mounts.MFS = lib.mkOption {
241241+ type = lib.types.str;
242242+ default = "/mfs";
243243+ description = "Where to mount the MFS namespace to";
244244+ };
239245 };
240246 };
241247 description = ''
···356362 ${cfg.dataDir}.d = defaultConfig;
357363 ${cfg.settings.Mounts.IPFS}.d = lib.mkIf (cfg.autoMount) defaultConfig;
358364 ${cfg.settings.Mounts.IPNS}.d = lib.mkIf (cfg.autoMount) defaultConfig;
365365+ ${cfg.settings.Mounts.MFS}.d = lib.mkIf (cfg.autoMount) defaultConfig;
359366 };
360367361368 # The hardened systemd unit breaks the fuse-mount function according to documentation in the unit file itself
···401408 ipfs --offline config replace -
402409 '';
403410 postStop = lib.mkIf cfg.autoMount ''
404404- # After an unclean shutdown the fuse mounts at cfg.settings.Mounts.IPFS and cfg.settings.Mounts.IPNS are locked
405405- umount --quiet '${cfg.settings.Mounts.IPFS}' '${cfg.settings.Mounts.IPNS}' || true
411411+ # After an unclean shutdown the fuse mounts at cfg.settings.Mounts.IPFS, cfg.settings.Mounts.IPNS and cfg.settings.Mounts.MFS are locked
412412+ umount --quiet '${cfg.settings.Mounts.IPFS}' '${cfg.settings.Mounts.IPNS}' '${cfg.settings.Mounts.MFS}' || true
406413 '';
407414 serviceConfig = {
408415 ExecStart = [
+38-5
nixos/tests/kubo/kubo-fuse.nix
···2727 testScript = ''
2828 start_all()
29293030- with subtest("FUSE mountpoint"):
3131- machine.fail("echo a | su bob -l -c 'ipfs add --quieter'")
3030+ with subtest("Create a file for testing"):
3131+ machine.succeed("echo 'fnord3' > /tmp/test.txt")
3232+3333+3434+ with subtest("/ipfs/ FUSE mountpoint"):
3535+ machine.fail("su bob -l -c 'ipfs add --quieter' < /tmp/test.txt")
3236 # The FUSE mount functionality is broken as of v0.13.0. This is still the case with v0.29.0.
3337 # See https://github.com/ipfs/kubo/issues/9044.
3438 # Workaround: using CID Version 1 avoids that.
···3640 "echo fnord3 | su alice -l -c 'ipfs add --quieter --cid-version=1'"
3741 ).strip()
38423939- machine.succeed(f"cat /ipfs/{ipfs_hash} | grep fnord3")
4343+ machine.succeed(f"diff /tmp/test.txt /ipfs/{ipfs_hash}")
4444+4545+4646+ with subtest("/mfs/ FUSE mountpoint"):
4747+ with subtest("Write the test file in three different ways"):
4848+ machine.succeed("cp /tmp/test.txt /mfs/test-1.txt")
4949+ machine.succeed("su alice -c 'ipfs files write --create /test-2.txt < /tmp/test.txt'")
5050+ machine.succeed(f"ipfs files cp /ipfs/{ipfs_hash} /test-3.txt")
5151+5252+ with subtest("Show the files (for debugging)"):
5353+ # Different hashes for the different ways of adding the file to the MFS probably come from different linking structures of the merkle tree. Copying the file to /mfs with `cp` is even non-deterministic.
5454+ machine.succeed("ipfs files ls --long >&2")
5555+ machine.succeed("ls -l /mfs >&2")
5656+5757+ with subtest("Check that everyone has permission to read the file (because of Mounts.FuseAllowOther)"):
5858+ machine.succeed("su alice -c 'cat /mfs/test-1.txt' | grep fnord3")
5959+ machine.succeed("su bob -c 'cat /mfs/test-1.txt' | grep fnord3")
6060+6161+ with subtest("Check the file contents"):
6262+ machine.succeed("diff /tmp/test.txt /mfs/test-1.txt")
6363+ machine.succeed("diff /tmp/test.txt /mfs/test-2.txt")
6464+ machine.succeed("diff /tmp/test.txt /mfs/test-3.txt")
6565+6666+ with subtest("Check the CID extended attribute"):
6767+ output = machine.succeed(
6868+ "getfattr --only-values --name=ipfs_cid /mfs/test-3.txt"
6969+ ).strip()
7070+ assert ipfs_hash == output, f"Expected {ipfs_hash} but got {output}"
40714141- with subtest("Unmounting of /ipns and /ipfs"):
7272+7373+ with subtest("Unmounting of /ipns, /ipfs and /mfs"):
4274 # Force Kubo to crash and wait for it to restart
4375 machine.systemctl("kill --signal=SIGKILL ipfs.service")
4476 machine.wait_for_unit("ipfs.service", timeout = 30)
45774646- machine.succeed(f"cat /ipfs/{ipfs_hash} | grep fnord3")
7878+ machine.succeed(f"diff /tmp/test.txt /ipfs/{ipfs_hash}")
7979+ machine.succeed("diff /tmp/test.txt /mfs/test-3.txt")
4780 '';
4881}
+2-2
pkgs/by-name/ku/kubo/package.nix
···8899buildGoModule rec {
1010 pname = "kubo";
1111- version = "0.34.1"; # When updating, also check if the repo version changed and adjust repoVersion below
1111+ version = "0.35.0"; # When updating, also check if the repo version changed and adjust repoVersion below
1212 rev = "v${version}";
13131414 passthru.repoVersion = "16"; # Also update kubo-migrator when changing the repo version
···1616 # Kubo makes changes to its source tarball that don't match the git source.
1717 src = fetchurl {
1818 url = "https://github.com/ipfs/kubo/releases/download/${rev}/kubo-source.tar.gz";
1919- hash = "sha256-wrAnmPfls7LFO3gQBISSmn4ucuUVmzvYEoz+eVc/A5M=";
1919+ hash = "sha256-OubXaa2JWbEaakDV6pExm5PkiZ5XPd9uG+S4KwWb0xQ=";
2020 };
21212222 # tarball contains multiple files/directories