summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorMilan Pässler <milan@petabyte.dev>2021-05-22 09:07:18 +0200
committerJohn Ericson <John.Ericson@Obsidian.Systems>2022-04-16 14:47:47 -0400
commit517c17420f39f1c1dd22460c836cb6473f8e12f1 (patch)
treee7145829c7395d292f0a651a861c7556ba288044 /nixos
parent685cececc239ea57dfa3e148dd6219269c526299 (diff)
downloadnixpkgs-517c17420f39f1c1dd22460c836cb6473f8e12f1.tar
nixpkgs-517c17420f39f1c1dd22460c836cb6473f8e12f1.tar.gz
nixpkgs-517c17420f39f1c1dd22460c836cb6473f8e12f1.tar.bz2
nixpkgs-517c17420f39f1c1dd22460c836cb6473f8e12f1.tar.lz
nixpkgs-517c17420f39f1c1dd22460c836cb6473f8e12f1.tar.xz
nixpkgs-517c17420f39f1c1dd22460c836cb6473f8e12f1.tar.zst
nixpkgs-517c17420f39f1c1dd22460c836cb6473f8e12f1.zip
nixos/nscd: add package option
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/system/nscd.nix20
1 files changed, 12 insertions, 8 deletions
diff --git a/nixos/modules/services/system/nscd.nix b/nixos/modules/services/system/nscd.nix
index 00a87e788dc..c9f2a60a31d 100644
--- a/nixos/modules/services/system/nscd.nix
+++ b/nixos/modules/services/system/nscd.nix
@@ -7,10 +7,6 @@ let
   nssModulesPath = config.system.nssModules.path;
   cfg = config.services.nscd;
 
-  nscd = if pkgs.stdenv.hostPlatform.libc == "glibc"
-         then pkgs.stdenv.cc.libc.bin
-         else pkgs.glibc.bin;
-
 in
 
 {
@@ -37,6 +33,14 @@ in
         description = "Configuration to use for Name Service Cache Daemon.";
       };
 
+      package = mkOption {
+        type = types.package;
+        default = if pkgs.stdenv.hostPlatform.libc == "glibc"
+          then pkgs.stdenv.cc.libc.bin
+          else pkgs.glibc.bin;
+        description = "package containing the nscd binary to be used by the service";
+      };
+
     };
 
   };
@@ -69,16 +73,16 @@ in
         # files. So prefix the ExecStart command with "!" to prevent systemd
         # from dropping privileges early. See ExecStart in systemd.service(5).
         serviceConfig =
-          { ExecStart = "!@${nscd}/sbin/nscd nscd";
+          { ExecStart = "!@${cfg.package}/bin/nscd nscd";
             Type = "forking";
             DynamicUser = true;
             RuntimeDirectory = "nscd";
             PIDFile = "/run/nscd/nscd.pid";
             Restart = "always";
             ExecReload =
-              [ "${nscd}/sbin/nscd --invalidate passwd"
-                "${nscd}/sbin/nscd --invalidate group"
-                "${nscd}/sbin/nscd --invalidate hosts"
+              [ "${cfg.package}/bin/nscd --invalidate passwd"
+                "${cfg.package}/bin/nscd --invalidate group"
+                "${cfg.package}/bin/nscd --invalidate hosts"
               ];
           };
       };