about summary refs log tree commit diff
path: root/pkgs/tools/security/gnupg
diff options
context:
space:
mode:
authorwucke13 <wucke13@gmail.com>2019-10-21 01:37:16 +0200
committerwucke13 <wucke13@gmail.com>2019-11-02 21:32:06 +0100
commitd1270ac85b811c476ae3bff22a60b11b1788b7db (patch)
treec7b71a5ae992daf8125ad669b21393a56d025b11 /pkgs/tools/security/gnupg
parent9d87889b3483eb53004b6cb77c2544bdfad8bab4 (diff)
downloadnixlib-d1270ac85b811c476ae3bff22a60b11b1788b7db.tar
nixlib-d1270ac85b811c476ae3bff22a60b11b1788b7db.tar.gz
nixlib-d1270ac85b811c476ae3bff22a60b11b1788b7db.tar.bz2
nixlib-d1270ac85b811c476ae3bff22a60b11b1788b7db.tar.lz
nixlib-d1270ac85b811c476ae3bff22a60b11b1788b7db.tar.xz
nixlib-d1270ac85b811c476ae3bff22a60b11b1788b7db.tar.zst
nixlib-d1270ac85b811c476ae3bff22a60b11b1788b7db.zip
gnugp: adding option for minimal build
Basically a flavour of gnugpg, which solely containts `bin/gnupg`.
Diffstat (limited to 'pkgs/tools/security/gnupg')
-rw-r--r--pkgs/tools/security/gnupg/22.nix23
1 files changed, 15 insertions, 8 deletions
diff --git a/pkgs/tools/security/gnupg/22.nix b/pkgs/tools/security/gnupg/22.nix
index f62f10c8cf9d..e54a1e1c5db9 100644
--- a/pkgs/tools/security/gnupg/22.nix
+++ b/pkgs/tools/security/gnupg/22.nix
@@ -1,17 +1,17 @@
 { fetchurl, fetchpatch, stdenv, pkgconfig, libgcrypt, libassuan, libksba
-, libgpgerror, libiconv, npth, gettext, texinfo, pcsclite, sqlite
-, buildPackages
+, libgpgerror, libiconv, npth, gettext, texinfo, buildPackages
 
 # Each of the dependencies below are optional.
 # Gnupg can be built without them at the cost of reduced functionality.
-, pinentry ? null, guiSupport ? false
-, adns ? null, gnutls ? null, libusb ? null, openldap ? null
-, readline ? null, zlib ? null, bzip2 ? null
+, guiSupport ? true, enableMinimal ? false
+, adns ? null , bzip2 ? null , gnutls ? null , libusb ? null , openldap ? null
+, pcsclite ? null , pinentry ? null , readline ? null , sqlite ? null , zlib ?
+null
 }:
 
 with stdenv.lib;
 
-assert guiSupport -> pinentry != null;
+assert guiSupport -> pinentry != null && enableMinimal == false;
 
 stdenv.mkDerivation rec {
   pname = "gnupg";
@@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
   postPatch = ''
     sed -i 's,hkps://hkps.pool.sks-keyservers.net,hkps://keys.openpgp.org,g' \
         configure doc/dirmngr.texi doc/gnupg.info-1
-  '' + stdenv.lib.optionalString stdenv.isLinux ''
+  '' + stdenv.lib.optionalString ( stdenv.isLinux && pcsclite != null) ''
     sed -i 's,"libpcsclite\.so[^"]*","${stdenv.lib.getLib pcsclite}/lib/libpcsclite.so",g' scd/scdaemon.c
   ''; #" fix Emacs syntax highlighting :-(
 
@@ -50,7 +50,14 @@ stdenv.mkDerivation rec {
     "--with-npth-prefix=${npth}"
   ] ++ optional guiSupport "--with-pinentry-pgm=${pinentry}/${pinentryBinaryPath}";
 
-  postInstall = ''
+  postInstall = if enableMinimal
+  then ''
+    rm -r $out/{libexec,sbin,share}
+    for f in `find $out/bin -type f -not -name gpg`
+    do
+      rm $f
+    done
+  '' else ''
     mkdir -p $out/lib/systemd/user
     for f in doc/examples/systemd-user/*.{service,socket} ; do
       substitute $f $out/lib/systemd/user/$(basename $f) \