diff --git a/etc/default.nix b/etc/default.nix index 450d96efc49..1e7f3dc7dd9 100644 --- a/etc/default.nix +++ b/etc/default.nix @@ -45,7 +45,10 @@ import ../helpers/make-etc.nix { } { # Hostname-to-IP mappings. - source = ./hosts; + source = pkgs.substituteAll{ + src = ./hosts; + extraHosts = config.get ["networking" "extraHosts"]; + }; target = "hosts"; } diff --git a/etc/hosts b/etc/hosts index 75721cd5afd..2774e092d85 100644 --- a/etc/hosts +++ b/etc/hosts @@ -1 +1,2 @@ 127.0.0.1 localhost +@extraHosts@ diff --git a/system/options.nix b/system/options.nix index 182653a1e6c..4e28b48d413 100644 --- a/system/options.nix +++ b/system/options.nix @@ -235,6 +235,12 @@ description = "The name of the machine."; } + { + name = ["networking" "extraHosts"]; + default = ""; + example = "192.168.0.1 lanlocalhost"; + description = "Pasted verbatim into /etc/hosts."; + } { name = ["networking" "useDHCP"];