about summary refs log tree commit diff
path: root/pkgs/tools/security/pinentry
diff options
context:
space:
mode:
authorSandro Jäckel <sandro.jaeckel@gmail.com>2022-12-05 02:42:22 +0100
committerSandro Jäckel <sandro.jaeckel@gmail.com>2022-12-05 02:42:22 +0100
commitffe45e9509d7ea49f6691e7cf8fc736388fa83ce (patch)
tree4a549497217ff0ac7d4c6af7e532cd7bbcd42f7d /pkgs/tools/security/pinentry
parent66d7e707a498216c44d714827ade5b1f66950e15 (diff)
pinentry: remove global with lib
Diffstat (limited to 'pkgs/tools/security/pinentry')
-rw-r--r--pkgs/tools/security/pinentry/default.nix29
1 files changed, 13 insertions, 16 deletions
diff --git a/pkgs/tools/security/pinentry/default.nix b/pkgs/tools/security/pinentry/default.nix
index 68e72171eca4f..68f642bf95b05 100644
--- a/pkgs/tools/security/pinentry/default.nix
+++ b/pkgs/tools/security/pinentry/default.nix
@@ -6,9 +6,7 @@
   ++ lib.optionals (!stdenv.isDarwin) [ "qt" ]
 }:
 
-with lib;
-
-assert isList enabledFlavors && enabledFlavors != [];
+assert lib.isList enabledFlavors && enabledFlavors != [];
 
 let
   pinentryMkDerivation =
@@ -18,11 +16,10 @@ let
 
   enableFeaturePinentry = f:
     let
-      info = flavorInfo.${f};
       flag = flavorInfo.${f}.flag or null;
     in
-      optionalString (flag != null)
-        (enableFeature (elem f enabledFlavors) ("pinentry-" + flag));
+      lib.optionalString (flag != null)
+        (lib.enableFeature (lib.elem f enabledFlavors) ("pinentry-" + flag));
 
   flavorInfo = {
     curses = { bin = "curses"; flag = "curses"; buildInputs = [ ncurses ]; };
@@ -45,17 +42,17 @@ pinentryMkDerivation rec {
   };
 
   nativeBuildInputs = [ pkg-config autoreconfHook ]
-    ++ concatMap(f: flavorInfo.${f}.nativeBuildInputs or []) enabledFlavors;
+    ++ lib.concatMap(f: flavorInfo.${f}.nativeBuildInputs or []) enabledFlavors;
   buildInputs = [ libgpg-error libassuan libsecret ]
     ++ lib.optional (!stdenv.isDarwin) libcap
-    ++ concatMap(f: flavorInfo.${f}.buildInputs or []) enabledFlavors;
+    ++ lib.concatMap(f: flavorInfo.${f}.buildInputs or []) enabledFlavors;
 
   dontWrapGApps = true;
   dontWrapQtApps = true;
 
   patches = [
     ./autoconf-ar.patch
-  ] ++ optionals (elem "gtk2" enabledFlavors) [
+  ] ++ lib.optionals (lib.elem "gtk2" enabledFlavors) [
     (fetchpatch {
       url = "https://salsa.debian.org/debian/pinentry/raw/debian/1.1.0-1/debian/patches/0007-gtk2-When-X11-input-grabbing-fails-try-again-over-0..patch";
       sha256 = "15r1axby3fdlzz9wg5zx7miv7gqx2jy4immaw4xmmw5skiifnhfd";
@@ -63,23 +60,23 @@ pinentryMkDerivation rec {
   ];
 
   configureFlags = [
-    (withFeature   (libcap != null)    "libcap")
-    (enableFeature (libsecret != null) "libsecret")
-  ] ++ (map enableFeaturePinentry (attrNames flavorInfo));
+    (lib.withFeature   (libcap != null)    "libcap")
+    (lib.enableFeature (libsecret != null) "libsecret")
+  ] ++ (map enableFeaturePinentry (lib.attrNames flavorInfo));
 
   postInstall =
-    concatStrings (flip map enabledFlavors (f:
+    lib.concatStrings (lib.flip map enabledFlavors (f:
       let
         binary = "pinentry-" + flavorInfo.${f}.bin;
       in ''
         moveToOutput bin/${binary} ${placeholder f}
         ln -sf ${placeholder f}/bin/${binary} ${placeholder f}/bin/pinentry
-      '' + optionalString (f == "gnome3") ''
+      '' + lib.optionalString (f == "gnome3") ''
         wrapGApp ${placeholder f}/bin/${binary}
-      '' + optionalString (f == "qt") ''
+      '' + lib.optionalString (f == "qt") ''
         wrapQtApp ${placeholder f}/bin/${binary}
       '')) + ''
-      ln -sf ${placeholder (head enabledFlavors)}/bin/pinentry-${flavorInfo.${head enabledFlavors}.bin} $out/bin/pinentry
+      ln -sf ${placeholder (lib.head enabledFlavors)}/bin/pinentry-${flavorInfo.${lib.head enabledFlavors}.bin} $out/bin/pinentry
     '';
 
   outputs = [ "out" ] ++ enabledFlavors;