Skip to content

Commit

Permalink
Format networking.nix
Browse files Browse the repository at this point in the history
  • Loading branch information
kurnevsky committed Jul 27, 2023
1 parent 99cc01c commit 5164fef
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions modules/environment/networking.nix
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,21 @@ in
'';
}];

networking.hostFiles = let
localhostHosts = pkgs.writeText "localhost-hosts" ''
127.0.0.1 localhost
::1 localhost
'';
stringHosts =
let
oneToString = set: ip: ip + " " + concatStringsSep " " set.${ip} + "\n";
allToString = set: concatMapStrings (oneToString set) (attrNames set);
in pkgs.writeText "string-hosts" (allToString (filterAttrs (_: v: v != []) cfg.hosts));
extraHosts = pkgs.writeText "extra-hosts" cfg.extraHosts;
in mkBefore [ localhostHosts stringHosts extraHosts ];
networking.hostFiles =
let
localhostHosts = pkgs.writeText "localhost-hosts" ''
127.0.0.1 localhost
::1 localhost
'';
stringHosts =
let
oneToString = set: ip: ip + " " + concatStringsSep " " set.${ip} + "\n";
allToString = set: concatMapStrings (oneToString set) (attrNames set);
in
pkgs.writeText "string-hosts" (allToString (filterAttrs (_: v: v != [ ]) cfg.hosts));
extraHosts = pkgs.writeText "extra-hosts" cfg.extraHosts;
in
mkBefore [ localhostHosts stringHosts extraHosts ];

environment.etc = {
# /etc/services: TCP/UDP port assignments.
Expand Down

0 comments on commit 5164fef

Please sign in to comment.