summaryrefslogtreecommitdiffstats
path: root/nixos/modules/config/nsswitch.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-08-24 17:08:55 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-08-24 17:10:19 +0200
commitd73025a5fe56e765bcb82c0f3740958debeaf3ce (patch)
tree137ddf2c3da8f8b04b602b119fc295b0bf23aa24 /nixos/modules/config/nsswitch.nix
parent9237e86d9979e6e6d510bade6ab87f5707c54ffc (diff)
Enable systemd's mymachines NSS module
It makes every local container registered with machined resolvable.
Diffstat (limited to 'nixos/modules/config/nsswitch.nix')
-rw-r--r--nixos/modules/config/nsswitch.nix44
1 files changed, 21 insertions, 23 deletions
diff --git a/nixos/modules/config/nsswitch.nix b/nixos/modules/config/nsswitch.nix
index 45695d9cb89f..549e731f3b08 100644
--- a/nixos/modules/config/nsswitch.nix
+++ b/nixos/modules/config/nsswitch.nix
@@ -35,29 +35,27 @@ in
config = {
- environment.etc =
- [ # Name Service Switch configuration file. Required by the C library.
- # !!! Factor out the mdns stuff. The avahi module should define
- # an option used by this module.
- { source = pkgs.writeText "nsswitch.conf"
- ''
- passwd: files ldap
- group: files ldap
- shadow: files ldap
- hosts: files ${optionalString nssmdns "mdns_minimal [NOTFOUND=return]"} dns ${optionalString nssmdns "mdns"} ${optionalString nsswins "wins"} myhostname
- networks: files dns
- ethers: files
- services: files
- protocols: files
- '';
- target = "nsswitch.conf";
- }
- ];
-
- # Use 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 fallbacks.
- system.nssModules = [ pkgs.systemd ];
+ # Name Service Switch configuration file. Required by the C
+ # library. !!! Factor out the mdns stuff. The avahi module
+ # should define an option used by this module.
+ environment.etc."nsswitch.conf".text =
+ ''
+ passwd: files ldap
+ group: files ldap
+ shadow: files ldap
+ hosts: files ${optionalString nssmdns "mdns_minimal [NOTFOUND=return]"} dns ${optionalString nssmdns "mdns"} ${optionalString nsswins "wins"} myhostname mymachines
+ networks: files dns
+ ethers: files
+ services: files
+ protocols: files
+ '';
+
+ # 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
+ # fallbacks. Systemd also provides nss-mymachines to return IP
+ # addresses of local containers.
+ system.nssModules = [ config.systemd.package ];
};
}