about summary refs log tree commit diff
path: root/pkgs/tools/security/pinentry
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2019-02-26 12:04:50 -0500
committerJohn Ericson <John.Ericson@Obsidian.Systems>2019-02-26 13:22:08 -0500
commitf07097902cf7355ec02341c0e6576f8d5bc0ccc6 (patch)
tree84a94a4efcce9913887a313c751f9654898dd06a /pkgs/tools/security/pinentry
parented60483257b62c32b5b58c6e91c9c8cd586f77d0 (diff)
pinentry: Use lib.string.{enable,with}Feature to avoid duplication
Diffstat (limited to 'pkgs/tools/security/pinentry')
-rw-r--r--pkgs/tools/security/pinentry/default.nix23
1 files changed, 9 insertions, 14 deletions
diff --git a/pkgs/tools/security/pinentry/default.nix b/pkgs/tools/security/pinentry/default.nix
index 3a7e1b5a3437a..705338634f11a 100644
--- a/pkgs/tools/security/pinentry/default.nix
+++ b/pkgs/tools/security/pinentry/default.nix
@@ -1,13 +1,8 @@
 { fetchurl, fetchpatch, stdenv, lib, pkgconfig
-, libgpgerror, libassuan, libcap ? null, libsecret ? null, ncurses ? null,  gtk2 ? null, gcr ? null, qt ? null
+, libgpgerror, libassuan, libcap ? null, libsecret ? null, ncurses ? null, gtk2 ? null, gcr ? null, qt ? null
 , enableEmacs ? false
 }:
 
-let
-  mkFlag = pfxTrue: pfxFalse: cond: name: "--${if cond then pfxTrue else pfxFalse}-${name}";
-  mkEnable = mkFlag "enable" "disable";
-  mkWith = mkFlag "with" "without";
-in
 stdenv.mkDerivation rec {
   name = "pinentry-1.1.0";
 
@@ -30,14 +25,14 @@ stdenv.mkDerivation rec {
   ];
 
   configureFlags = [
-    (mkWith   (libcap != null)    "libcap")
-    (mkEnable (libsecret != null) "libsecret")
-    (mkEnable (ncurses != null)   "pinentry-curses")
-    (mkEnable true                "pinentry-tty")
-    (mkEnable enableEmacs         "pinentry-emacs")
-    (mkEnable (gtk2 != null)      "pinentry-gtk2")
-    (mkEnable (gcr != null)       "pinentry-gnome3")
-    (mkEnable (qt != null)        "pinentry-qt")
+    (stdenv.lib.withFeature   (libcap != null)    "libcap")
+    (stdenv.lib.enableFeature (libsecret != null) "libsecret")
+    (stdenv.lib.enableFeature (ncurses != null)   "pinentry-curses")
+    (stdenv.lib.enableFeature true                "pinentry-tty")
+    (stdenv.lib.enableFeature enableEmacs         "pinentry-emacs")
+    (stdenv.lib.enableFeature (gtk2 != null)      "pinentry-gtk2")
+    (stdenv.lib.enableFeature (gcr != null)       "pinentry-gnome3")
+    (stdenv.lib.enableFeature (qt != null)        "pinentry-qt")
   ];
 
   nativeBuildInputs = [ pkgconfig ];