mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
Revert "treewide: migrate nixos modules to networking.hosts"
This reverts commit cd64f1bd87
.
This commit is contained in:
parent
7c873c2d00
commit
c87464cb0c
4 changed files with 27 additions and 27 deletions
|
@ -3,15 +3,15 @@
|
|||
let
|
||||
inherit (lib)
|
||||
attrNames
|
||||
concatMapAttrs
|
||||
concatMap
|
||||
concatMapStrings
|
||||
flip
|
||||
forEach
|
||||
head
|
||||
listToAttrs
|
||||
mkDefault
|
||||
mkOption
|
||||
nameValuePair
|
||||
optionalAttrs
|
||||
optionalString
|
||||
range
|
||||
toLower
|
||||
|
@ -91,22 +91,23 @@ let
|
|||
# interfaces, use the IP address corresponding to
|
||||
# the first interface (i.e. the first network in its
|
||||
# virtualisation.vlans option).
|
||||
networking.hosts = concatMapAttrs (
|
||||
name: config:
|
||||
networking.extraHosts = flip concatMapStrings (attrNames nodes) (
|
||||
m':
|
||||
let
|
||||
config = nodes.${m'};
|
||||
hostnames =
|
||||
optionalString (
|
||||
config.networking.domain != null
|
||||
) "${config.networking.hostName}.${config.networking.domain} "
|
||||
+ "${config.networking.hostName}\n";
|
||||
in
|
||||
optionalAttrs (config.networking.primaryIPAddress != "") {
|
||||
"${config.networking.primaryIPAddress}" = [ hostnames ];
|
||||
}
|
||||
// optionalAttrs (config.networking.primaryIPv6Address != "") {
|
||||
"${config.networking.primaryIPv6Address}" = [ hostnames ];
|
||||
}
|
||||
) nodes;
|
||||
optionalString (
|
||||
config.networking.primaryIPAddress != ""
|
||||
) "${config.networking.primaryIPAddress} ${hostnames}"
|
||||
+ optionalString (config.networking.primaryIPv6Address != "") (
|
||||
"${config.networking.primaryIPv6Address} ${hostnames}"
|
||||
)
|
||||
);
|
||||
|
||||
virtualisation.qemu.options = qemuOptions;
|
||||
boot.initrd.services.udev.rules = concatMapStrings (x: x + "\n") udevRules;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue