diff options
author | Daiderd Jordan <daiderd@gmail.com> | 2019-02-15 19:22:14 +0100 |
---|---|---|
committer | Daiderd Jordan <daiderd@gmail.com> | 2019-02-22 23:00:24 +0100 |
commit | 11cd761dbf3e1e842b809a16b7b3f5d660835fce (patch) | |
tree | 23224df726bc36d9a9098df7000893d35773f56d | |
parent | c400bdaa4990978078102fb75b026c10713c620c (diff) | |
download | nixlib-11cd761dbf3e1e842b809a16b7b3f5d660835fce.tar nixlib-11cd761dbf3e1e842b809a16b7b3f5d660835fce.tar.gz nixlib-11cd761dbf3e1e842b809a16b7b3f5d660835fce.tar.bz2 nixlib-11cd761dbf3e1e842b809a16b7b3f5d660835fce.tar.lz nixlib-11cd761dbf3e1e842b809a16b7b3f5d660835fce.tar.xz nixlib-11cd761dbf3e1e842b809a16b7b3f5d660835fce.tar.zst nixlib-11cd761dbf3e1e842b809a16b7b3f5d660835fce.zip |
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.
-rw-r--r-- | nixos/modules/config/nsswitch.nix | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/nixos/modules/config/nsswitch.nix b/nixos/modules/config/nsswitch.nix index b601e908e49f..13277fe56e42 100644 --- a/nixos/modules/config/nsswitch.nix +++ b/nixos/modules/config/nsswitch.nix @@ -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 |