nixos/nsswitch: add option to configure nssHosts
Enables adding or overriding the default nsswitch hosts in a generic way for packages without a nixos module.
This commit is contained in:
parent
c400bdaa49
commit
11cd761dbf
@ -61,6 +61,15 @@ in {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
system.nssHosts = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [];
|
||||||
|
example = [ "mdns" ];
|
||||||
|
description = ''
|
||||||
|
List of host entries to configure in <filename>/etc/nsswitch.conf</filename>.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
@ -85,7 +94,7 @@ in {
|
|||||||
group: ${concatStringsSep " " passwdArray}
|
group: ${concatStringsSep " " passwdArray}
|
||||||
shadow: ${concatStringsSep " " shadowArray}
|
shadow: ${concatStringsSep " " shadowArray}
|
||||||
|
|
||||||
hosts: ${concatStringsSep " " hostArray}
|
hosts: ${concatStringsSep " " config.system.nssHosts}
|
||||||
networks: files
|
networks: files
|
||||||
|
|
||||||
ethers: files
|
ethers: files
|
||||||
@ -94,6 +103,8 @@ in {
|
|||||||
rpc: files
|
rpc: files
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
system.nssHosts = hostArray;
|
||||||
|
|
||||||
# Systemd provides nss-myhostname to ensure that our hostname
|
# Systemd provides nss-myhostname to ensure that our hostname
|
||||||
# always resolves to a valid IP address. It returns all locally
|
# always resolves to a valid IP address. It returns all locally
|
||||||
# configured IP addresses, or ::1 and 127.0.0.2 as
|
# configured IP addresses, or ::1 and 127.0.0.2 as
|
||||||
|
Loading…
Reference in New Issue
Block a user