mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-09-21 20:49:52 +03:00
Added networking.extraLocalHosts option
It adds its contents to '127.0.0.1' line of /etc/hosts It makes possible to point multiple domains to localhost in correct way
This commit is contained in:
parent
c31d21c9b1
commit
f9ec52dedc
@ -20,12 +20,24 @@ in
|
|||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
|
networking.extraLocalHosts = lib.mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [];
|
||||||
|
example = [ "localhost.localdomain" "workinprogress.example.com" ];
|
||||||
|
description = ''
|
||||||
|
Additional entries to be appended to 127.0.0.1 entry in <filename>/etc/hosts</filename>.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
networking.extraHosts = lib.mkOption {
|
networking.extraHosts = lib.mkOption {
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
default = "";
|
default = "";
|
||||||
example = "192.168.0.1 lanlocalhost";
|
example = "192.168.0.1 lanlocalhost";
|
||||||
description = ''
|
description = ''
|
||||||
Additional entries to be appended to <filename>/etc/hosts</filename>.
|
Additional entries to be appended to <filename>/etc/hosts</filename>.
|
||||||
|
Note that entries for 127.0.0.1 will not always work correctly if added from here.
|
||||||
|
They should be added via <literal>networking.extraLocalHosts</literal>.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -187,11 +199,11 @@ in
|
|||||||
"rpc".source = pkgs.glibc.out + "/etc/rpc";
|
"rpc".source = pkgs.glibc.out + "/etc/rpc";
|
||||||
|
|
||||||
# /etc/hosts: Hostname-to-IP mappings.
|
# /etc/hosts: Hostname-to-IP mappings.
|
||||||
"hosts".text =
|
"hosts".text = let foo = concatStringsSep " " cfg.extraLocalHosts; in
|
||||||
''
|
''
|
||||||
127.0.0.1 localhost
|
127.0.0.1 localhost ${foo}
|
||||||
${optionalString cfg.enableIPv6 ''
|
${optionalString cfg.enableIPv6 ''
|
||||||
::1 localhost
|
::1 localhost ${foo}
|
||||||
''}
|
''}
|
||||||
${cfg.extraHosts}
|
${cfg.extraHosts}
|
||||||
'';
|
'';
|
||||||
|
Loading…
Reference in New Issue
Block a user