summary refs log tree commit diff
diff options
context:
space:
mode:
authorBob van der Linden <bobvanderlinden@gmail.com>2023-10-04 15:57:17 +0200
committerBob van der Linden <bobvanderlinden@gmail.com>2023-10-08 10:09:12 +0200
commit423c86a70b5ba81639e1c66f9fe197814769e4d2 (patch)
tree58559bffc8563c29359066526e036b61d1e2f991
parent6eec833b86b16ae8e83fc4046f1e9f765e18a226 (diff)
downloadnixpkgs-423c86a70b5ba81639e1c66f9fe197814769e4d2.tar
nixpkgs-423c86a70b5ba81639e1c66f9fe197814769e4d2.tar.gz
nixpkgs-423c86a70b5ba81639e1c66f9fe197814769e4d2.tar.bz2
nixpkgs-423c86a70b5ba81639e1c66f9fe197814769e4d2.tar.lz
nixpkgs-423c86a70b5ba81639e1c66f9fe197814769e4d2.tar.xz
nixpkgs-423c86a70b5ba81639e1c66f9fe197814769e4d2.tar.zst
nixpkgs-423c86a70b5ba81639e1c66f9fe197814769e4d2.zip
nixos/locate: rename option `locate` -> `package`
-rw-r--r--nixos/modules/misc/locate.nix21
1 files changed, 11 insertions, 10 deletions
diff --git a/nixos/modules/misc/locate.nix b/nixos/modules/misc/locate.nix
index 569d81e245c..3c76d17086b 100644
--- a/nixos/modules/misc/locate.nix
+++ b/nixos/modules/misc/locate.nix
@@ -4,14 +4,15 @@ with lib;
 
 let
   cfg = config.services.locate;
-  isMLocate = hasPrefix "mlocate" cfg.locate.name;
-  isPLocate = hasPrefix "plocate" cfg.locate.name;
+  isMLocate = hasPrefix "mlocate" cfg.package.name;
+  isPLocate = hasPrefix "plocate" cfg.package.name;
   isMorPLocate = isMLocate || isPLocate;
-  isFindutils = hasPrefix "findutils" cfg.locate.name;
+  isFindutils = hasPrefix "findutils" cfg.package.name;
 in
 {
   imports = [
     (mkRenamedOptionModule [ "services" "locate" "period" ] [ "services" "locate" "interval" ])
+    (mkRenamedOptionModule [ "services" "locate" "locate" ] [ "services" "locate" "package" ])
     (mkRemovedOptionModule [ "services" "locate" "includeStore" ] "Use services.locate.prunePaths")
   ];
 
@@ -25,10 +26,10 @@ in
       '';
     };
 
-    locate = mkOption {
+    package = mkOption {
       type = package;
       default = pkgs.findutils.locate;
-      defaultText = literalExpression "pkgs.findutils";
+      defaultText = literalExpression "pkgs.findutils.locate";
       example = literalExpression "pkgs.mlocate";
       description = lib.mdDoc ''
         The locate implementation to use
@@ -218,11 +219,11 @@ in
         };
         mlocate = mkIf isMLocate {
           group = "mlocate";
-          source = "${cfg.locate}/bin/locate";
+          source = "${cfg.package}/bin/locate";
         };
         plocate = mkIf isPLocate {
           group = "plocate";
-          source = "${cfg.locate}/bin/plocate";
+          source = "${cfg.package}/bin/plocate";
         };
       in
       mkIf isMorPLocate {
@@ -230,7 +231,7 @@ in
         plocate = mkIf isPLocate (mkMerge [ common plocate ]);
       };
 
-    environment.systemPackages = [ cfg.locate ];
+    environment.systemPackages = [ cfg.package ];
 
     environment.variables.LOCATE_PATH = cfg.output;
 
@@ -268,13 +269,13 @@ in
             args = concatLists (map toFlags [ "pruneFS" "pruneNames" "prunePaths" ]);
           in
           ''
-            exec ${cfg.locate}/bin/updatedb \
+            exec ${cfg.package}/bin/updatedb \
               --output ${toString cfg.output} ${concatStringsSep " " args} \
               --prune-bind-mounts ${if cfg.pruneBindMounts then "yes" else "no"} \
               ${concatStringsSep " " cfg.extraFlags}
           ''
         else ''
-          exec ${cfg.locate}/bin/updatedb \
+          exec ${cfg.package}/bin/updatedb \
             ${optionalString (cfg.localuser != null && !isMorPLocate) "--localuser=${cfg.localuser}"} \
             --output=${toString cfg.output} ${concatStringsSep " " cfg.extraFlags}
         '';