diff options
author | Pavol Rusnak <pavol@rusnak.io> | 2022-07-09 13:37:24 +0200 |
---|---|---|
committer | Pavol Rusnak <pavol@rusnak.io> | 2022-07-09 13:38:49 +0200 |
commit | 3d881da967f5befe80d261b9af91e2c274e572f1 (patch) | |
tree | aea6f304c8e33b4f14413dac0a8b434a70df8a3c /pkgs/tools/security/pinentry | |
parent | 72848cc78ef91a52e1da27f66d04742de4e7c9ff (diff) |
pinentry: replace mkFlag with lib.enableFeature and lib.withFeature
Diffstat (limited to 'pkgs/tools/security/pinentry')
-rw-r--r-- | pkgs/tools/security/pinentry/default.nix | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/pkgs/tools/security/pinentry/default.nix b/pkgs/tools/security/pinentry/default.nix index 2de900483f09b..68e72171eca4f 100644 --- a/pkgs/tools/security/pinentry/default.nix +++ b/pkgs/tools/security/pinentry/default.nix @@ -16,18 +16,13 @@ let then mkDerivation else stdenv.mkDerivation; - mkFlag = pfxTrue: pfxFalse: cond: name: - "--${if cond then pfxTrue else pfxFalse}-${name}"; - mkEnable = mkFlag "enable" "disable"; - mkWith = mkFlag "with" "without"; - - mkEnablePinentry = f: + enableFeaturePinentry = f: let info = flavorInfo.${f}; flag = flavorInfo.${f}.flag or null; in optionalString (flag != null) - (mkEnable (elem f enabledFlavors) ("pinentry-" + flag)); + (enableFeature (elem f enabledFlavors) ("pinentry-" + flag)); flavorInfo = { curses = { bin = "curses"; flag = "curses"; buildInputs = [ ncurses ]; }; @@ -68,9 +63,9 @@ pinentryMkDerivation rec { ]; configureFlags = [ - (mkWith (libcap != null) "libcap") - (mkEnable (libsecret != null) "libsecret") - ] ++ (map mkEnablePinentry (attrNames flavorInfo)); + (withFeature (libcap != null) "libcap") + (enableFeature (libsecret != null) "libsecret") + ] ++ (map enableFeaturePinentry (attrNames flavorInfo)); postInstall = concatStrings (flip map enabledFlavors (f: |