diff options
author | Florian Klink <flokli@flokli.de> | 2020-05-05 15:03:14 +0200 |
---|---|---|
committer | Florian Klink <flokli@flokli.de> | 2020-05-05 15:59:30 +0200 |
commit | c0995d22eed1a19ac9442c8460c18dd6a4c389b7 (patch) | |
tree | e5ee334ee66e7d9a5693705c63949ab7d9a211ce /nixos/modules/system/boot | |
parent | 7426bec45ef03c55bfc5bb27cdc60d6163aeed04 (diff) | |
download | nixlib-c0995d22eed1a19ac9442c8460c18dd6a4c389b7.tar nixlib-c0995d22eed1a19ac9442c8460c18dd6a4c389b7.tar.gz nixlib-c0995d22eed1a19ac9442c8460c18dd6a4c389b7.tar.bz2 nixlib-c0995d22eed1a19ac9442c8460c18dd6a4c389b7.tar.lz nixlib-c0995d22eed1a19ac9442c8460c18dd6a4c389b7.tar.xz nixlib-c0995d22eed1a19ac9442c8460c18dd6a4c389b7.tar.zst nixlib-c0995d22eed1a19ac9442c8460c18dd6a4c389b7.zip |
nixos/systemd: move NSS module logic to systemd module
We keep the conditional on only adding if nscd is enabled for now.
Diffstat (limited to 'nixos/modules/system/boot')
-rw-r--r-- | nixos/modules/system/boot/systemd.nix | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index 2167df60bc9a..df20a433d524 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -827,6 +827,27 @@ in system.build.units = cfg.units; + # Systemd provides various NSS modules to look up dynamic users, locally + # configured IP adresses and local container hostnames. + # On NixOS, these can only be passed to the NSS system via nscd (and its + # LD_LIBRARY_PATH), which is why it's usually a very good idea to have nscd + # enabled (also see the config.nscd.enable description). + # While there is already an assertion in place complaining loudly about + # having nssModules configured and nscd disabled, for some reason we still + # check for nscd being enabled before adding to nssModules. + system.nssModules = optional config.services.nscd.enable systemd.out; + system.nssDatabases = mkIf config.services.nscd.enable { + hosts = (mkMerge [ + [ "mymachines" ] + (mkOrder 1600 [ "myhostname" ] # 1600 to ensure it's always the last + ) + ]); + passwd = (mkMerge [ + [ "mymachines" ] + (mkAfter [ "systemd" ]) + ]); + }; + environment.systemPackages = [ systemd ]; environment.etc = let |