Merge pull request #55843 from LnL7/nixos-nss-hosts

nixos-nsswitch: add option to configure nssHosts
This commit is contained in:
Silvan Mosberger 2019-02-22 23:04:01 +01:00 committed by GitHub
commit cc98350d55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 = {
@ -85,7 +94,7 @@ in {
group: ${concatStringsSep " " passwdArray}
shadow: ${concatStringsSep " " shadowArray}
hosts: ${concatStringsSep " " hostArray}
hosts: ${concatStringsSep " " config.system.nssHosts}
networks: files
ethers: files
@ -94,6 +103,8 @@ in {
rpc: files
'';
system.nssHosts = hostArray;
# Systemd provides nss-myhostname to ensure that our hostname
# always resolves to a valid IP address. It returns all locally
# configured IP addresses, or ::1 and 127.0.0.2 as