summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorSilvan Mosberger <infinisil@icloud.com>2019-02-22 23:04:01 +0100
committerGitHub <noreply@github.com>2019-02-22 23:04:01 +0100
commitcc98350d55522ebb2b7d35db32bc7c2fc5b8b273 (patch)
tree8136ce5a145e802adefeb3ef13f0d9cd78d0b9ee /nixos
parent3b2824d04be4836672ea7cbe2b295f41f5b13b21 (diff)
parent11cd761dbf3e1e842b809a16b7b3f5d660835fce (diff)
downloadnixpkgs-cc98350d55522ebb2b7d35db32bc7c2fc5b8b273.tar
nixpkgs-cc98350d55522ebb2b7d35db32bc7c2fc5b8b273.tar.gz
nixpkgs-cc98350d55522ebb2b7d35db32bc7c2fc5b8b273.tar.bz2
nixpkgs-cc98350d55522ebb2b7d35db32bc7c2fc5b8b273.tar.lz
nixpkgs-cc98350d55522ebb2b7d35db32bc7c2fc5b8b273.tar.xz
nixpkgs-cc98350d55522ebb2b7d35db32bc7c2fc5b8b273.tar.zst
nixpkgs-cc98350d55522ebb2b7d35db32bc7c2fc5b8b273.zip
Merge pull request #55843 from LnL7/nixos-nss-hosts
nixos-nsswitch: add option to configure nssHosts
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/config/nsswitch.nix13
1 files changed, 12 insertions, 1 deletions
diff --git a/nixos/modules/config/nsswitch.nix b/nixos/modules/config/nsswitch.nix
index b601e908e49..13277fe56e4 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