mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
nixos/cjdns: Don't use IFD for extra hosts
This commit is contained in:
parent
ec6e4db6e4
commit
1906320e68
1 changed files with 8 additions and 12 deletions
|
@ -29,17 +29,13 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
# Additional /etc/hosts entries for peers with an associated hostname
|
# Additional /etc/hosts entries for peers with an associated hostname
|
||||||
cjdnsExtraHosts = import (pkgs.runCommand "cjdns-hosts" {}
|
cjdnsExtraHosts = pkgs.runCommandNoCC "cjdns-hosts" {} ''
|
||||||
# Generate a builder that produces an output usable as a Nix string value
|
exec >$out
|
||||||
''
|
${concatStringsSep "\n" (mapAttrsToList (k: v:
|
||||||
exec >$out
|
optionalString (v.hostname != "")
|
||||||
echo \'\'
|
"echo $(${pkgs.cjdns}/bin/publictoip6 ${v.publicKey}) ${v.hostname}")
|
||||||
${concatStringsSep "\n" (mapAttrsToList (k: v:
|
(cfg.ETHInterface.connectTo // cfg.UDPInterface.connectTo))}
|
||||||
optionalString (v.hostname != "")
|
'';
|
||||||
"echo $(${pkgs.cjdns}/bin/publictoip6 ${v.publicKey}) ${v.hostname}")
|
|
||||||
(cfg.ETHInterface.connectTo // cfg.UDPInterface.connectTo))}
|
|
||||||
echo \'\'
|
|
||||||
'');
|
|
||||||
|
|
||||||
parseModules = x:
|
parseModules = x:
|
||||||
x // { connectTo = mapAttrs (name: value: { inherit (value) password publicKey; }) x.connectTo; };
|
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 = [
|
assertions = [
|
||||||
{ assertion = ( cfg.ETHInterface.bind != "" || cfg.UDPInterface.bind != "" || cfg.confFile != null );
|
{ assertion = ( cfg.ETHInterface.bind != "" || cfg.UDPInterface.bind != "" || cfg.confFile != null );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue