Skip to content

Commit

Permalink
nixos/kubo: cleanup
Browse files Browse the repository at this point in the history
- Add note explaining why enabling the Kubo daemon won't fully work immediately and requires logging in again
- Use `builtins.isList addrIn` instead of `builtins.typeOf addrIn == "list"`
- Fix indentation
  • Loading branch information
Luflosi committed Jan 14, 2024
1 parent 836a47d commit a4c451f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions nixos/modules/services/network-filesystems/kubo.nix
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ let

multiaddrsToListenStreams = addrIn:
let
addrs = if builtins.typeOf addrIn == "list"
addrs = if builtins.isList addrIn
then addrIn else [ addrIn ];
unfilteredResult = map multiaddrToListenStream addrs;
in
builtins.filter (addr: addr != null) unfilteredResult;

multiaddrsToListenDatagrams = addrIn:
let
addrs = if builtins.typeOf addrIn == "list"
addrs = if builtins.isList addrIn
then addrIn else [ addrIn ];
unfilteredResult = map multiaddrToListenDatagram addrs;
in
Expand Down Expand Up @@ -99,7 +99,12 @@ in

services.kubo = {

enable = mkEnableOption (lib.mdDoc "Interplanetary File System (WARNING: may cause severe network degradation)");
enable = mkEnableOption (lib.mdDoc ''
the Interplanetary File System (WARNING: may cause severe network degradation).
NOTE: after enabling this option and rebuilding your system, you need to log out
and back in for the `IPFS_PATH` environment variable to be present in your shell.
Until you do that, the CLI tools won't be able to talk to the daemon by default
'');

package = mkPackageOption pkgs "kubo" { };

Expand Down Expand Up @@ -274,8 +279,8 @@ in
{
assertion = !((lib.versionAtLeast cfg.package.version "0.21") && (builtins.hasAttr "Experimental" cfg.settings) && (builtins.hasAttr "AcceleratedDHTClient" cfg.settings.Experimental));
message = ''
The `services.kubo.settings.Experimental.AcceleratedDHTClient` option was renamed to `services.kubo.settings.Routing.AcceleratedDHTClient` in Kubo 0.21.
'';
The `services.kubo.settings.Experimental.AcceleratedDHTClient` option was renamed to `services.kubo.settings.Routing.AcceleratedDHTClient` in Kubo 0.21.
'';
}
];

Expand Down

0 comments on commit a4c451f

Please sign in to comment.