diff options
author | Silvan Mosberger <contact@infinisil.com> | 2020-03-07 02:01:19 +0100 |
---|---|---|
committer | Silvan Mosberger <contact@infinisil.com> | 2020-03-07 02:01:19 +0100 |
commit | 1906320e68f04664f3bfebffb786db80deefb16f (patch) | |
tree | d731176f7103636700abe19c55d8668146f2c22e /nixos/modules/services/networking/cjdns.nix | |
parent | ec6e4db6e413219fd55ba52d207de4d59a356057 (diff) | |
download | nixlib-1906320e68f04664f3bfebffb786db80deefb16f.tar nixlib-1906320e68f04664f3bfebffb786db80deefb16f.tar.gz nixlib-1906320e68f04664f3bfebffb786db80deefb16f.tar.bz2 nixlib-1906320e68f04664f3bfebffb786db80deefb16f.tar.lz nixlib-1906320e68f04664f3bfebffb786db80deefb16f.tar.xz nixlib-1906320e68f04664f3bfebffb786db80deefb16f.tar.zst nixlib-1906320e68f04664f3bfebffb786db80deefb16f.zip |
nixos/cjdns: Don't use IFD for extra hosts
Diffstat (limited to 'nixos/modules/services/networking/cjdns.nix')
-rw-r--r-- | nixos/modules/services/networking/cjdns.nix | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/nixos/modules/services/networking/cjdns.nix b/nixos/modules/services/networking/cjdns.nix index 3fb85b16cbe2..5f912a57845f 100644 --- a/nixos/modules/services/networking/cjdns.nix +++ b/nixos/modules/services/networking/cjdns.nix @@ -29,17 +29,13 @@ let }; # Additional /etc/hosts entries for peers with an associated hostname - cjdnsExtraHosts = import (pkgs.runCommand "cjdns-hosts" {} - # Generate a builder that produces an output usable as a Nix string value - '' - exec >$out - echo \'\' - ${concatStringsSep "\n" (mapAttrsToList (k: v: - optionalString (v.hostname != "") - "echo $(${pkgs.cjdns}/bin/publictoip6 ${v.publicKey}) ${v.hostname}") - (cfg.ETHInterface.connectTo // cfg.UDPInterface.connectTo))} - echo \'\' - ''); + cjdnsExtraHosts = pkgs.runCommandNoCC "cjdns-hosts" {} '' + exec >$out + ${concatStringsSep "\n" (mapAttrsToList (k: v: + optionalString (v.hostname != "") + "echo $(${pkgs.cjdns}/bin/publictoip6 ${v.publicKey}) ${v.hostname}") + (cfg.ETHInterface.connectTo // cfg.UDPInterface.connectTo))} + ''; parseModules = x: x // { connectTo = mapAttrs (name: value: { inherit (value) password publicKey; }) x.connectTo; }; @@ -278,7 +274,7 @@ in }; }; - networking.extraHosts = mkIf cfg.addExtraHosts cjdnsExtraHosts; + networking.hostFiles = mkIf cfg.addExtraHosts [ cjdnsExtraHosts ]; assertions = [ { assertion = ( cfg.ETHInterface.bind != "" || cfg.UDPInterface.bind != "" || cfg.confFile != null ); |