diff options
author | Eric Litak <elitak@gmail.com> | 2017-08-27 09:52:56 -0700 |
---|---|---|
committer | Eric Litak <elitak@gmail.com> | 2017-08-30 08:17:34 -0700 |
commit | 5f9bad6ceb75713c051ef722f5b57dd6c036a67a (patch) | |
tree | d76b129ff863e8cd4a37c246627a2461a6b75b35 /nixos/modules/services/network-filesystems | |
parent | a48a2c4f788003a9e19dd63730732f82e835ba0f (diff) | |
download | nixlib-5f9bad6ceb75713c051ef722f5b57dd6c036a67a.tar nixlib-5f9bad6ceb75713c051ef722f5b57dd6c036a67a.tar.gz nixlib-5f9bad6ceb75713c051ef722f5b57dd6c036a67a.tar.bz2 nixlib-5f9bad6ceb75713c051ef722f5b57dd6c036a67a.tar.lz nixlib-5f9bad6ceb75713c051ef722f5b57dd6c036a67a.tar.xz nixlib-5f9bad6ceb75713c051ef722f5b57dd6c036a67a.tar.zst nixlib-5f9bad6ceb75713c051ef722f5b57dd6c036a67a.zip |
ipfs: add extraConfig option
Diffstat (limited to 'nixos/modules/services/network-filesystems')
-rw-r--r-- | nixos/modules/services/network-filesystems/ipfs.nix | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/nixos/modules/services/network-filesystems/ipfs.nix b/nixos/modules/services/network-filesystems/ipfs.nix index 74711a10abb2..f93f5bcb6287 100644 --- a/nixos/modules/services/network-filesystems/ipfs.nix +++ b/nixos/modules/services/network-filesystems/ipfs.nix @@ -103,11 +103,32 @@ in ''; }; + extraConfig = mkOption { + type = types.attrs; + description = toString [ + "Attrset of daemon configuration to set using `ipfs config`, every time the daemon starts." + "These are applied last, so may override configuration set by other options in this module." + "Keep in mind that this configuration is stateful; i.e., unsetting anything in here does not reset the value to the default!" + ]; + default = {}; + example = { + Datastore.StorageMax = "100GB"; + Discovery.MDNS.Enabled = false; + Bootstrap = [ + "/ip4/128.199.219.111/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu" + "/ip4/162.243.248.213/tcp/4001/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm" + ]; + Swarm.AddrFilters = null; + }; + + }; + extraFlags = mkOption { type = types.listOf types.str; description = "Extra flags passed to the IPFS daemon"; default = []; }; + }; }; @@ -155,7 +176,19 @@ in ${ipfs}/bin/ipfs --local config Mounts.FuseAllowOther --json true mkdir -p $(${ipfs}/bin/ipfs --local config Mounts.IPFS) mkdir -p $(${ipfs}/bin/ipfs --local config Mounts.IPNS) - ''; + '' + concatStringsSep "\n" (collect + isString + (mapAttrsRecursive + (path: value: + # Using heredoc below so that the value is never improperly quoted + '' + read value <<EOF + ${builtins.toJSON value} + EOF + ipfs --local config --json "${concatStringsSep "." path}" "$value" + '') + cfg.extraConfig) + ); serviceConfig = { User = cfg.user; |