diff options
author | rnhmjoj <rnhmjoj@inventati.org> | 2021-02-24 20:53:45 +0100 |
---|---|---|
committer | rnhmjoj <rnhmjoj@inventati.org> | 2021-03-31 21:35:37 +0200 |
commit | 61b7cab4811e0e90937bcc8b4c1ca32b387c895c (patch) | |
tree | db5dc9f491f86fe61dc23dcf042ea6eed08327aa /pkgs/tools/misc/lbdb | |
parent | 3966039910db296c1c2dca2120ab0976952fe11c (diff) |
treewide: use perl.withPackages when possible
Since 03eaa48 added perl.withPackages, there is a canonical way to create a perl interpreter from a list of libraries, for use in script shebangs or generic build inputs. This method is declarative (what we are doing is clear), produces short shebangs[1] and needs not to wrap existing scripts. Unfortunately there are a few exceptions that I've found: 1. Scripts that are calling perl with the -T switch. This makes perl ignore PERL5LIB, which is what perl.withPackages is using to inform the interpreter of the library paths. 2. Perl packages that depends on libraries in their own path. This is not possible because perl.withPackages works at build time. The workaround is to add `-I $out/${perl.libPrefix}` to the shebang. In all other cases I propose to switch to perl.withPackages. [1]: https://lwn.net/Articles/779997/
Diffstat (limited to 'pkgs/tools/misc/lbdb')
-rw-r--r-- | pkgs/tools/misc/lbdb/default.nix | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/pkgs/tools/misc/lbdb/default.nix b/pkgs/tools/misc/lbdb/default.nix index fd8b805743aca..ea4b2a9cbbc52 100644 --- a/pkgs/tools/misc/lbdb/default.nix +++ b/pkgs/tools/misc/lbdb/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, fetchpatch, perl, perlPackages, finger_bsd, makeWrapper +{ lib, stdenv, fetchurl, fetchpatch, perl, finger_bsd , abook ? null , gnupg ? null , goobook ? null @@ -8,9 +8,8 @@ let version = "0.48.1"; + perl' = perl.withPackages (p: with p; [ ConvertASN1 perlldap AuthenSASL ]); in -with lib; -with perlPackages; stdenv.mkDerivation { pname = "lbdb"; inherit version; @@ -19,20 +18,20 @@ stdenv.mkDerivation { sha256 = "1gr5l2fr9qbdccga8bhsrpvz6jxigvfkdxrln9wyf2xpps5cdjxh"; }; - nativeBuildInputs = [ makeWrapper ]; - buildInputs = [ goobook perl ConvertASN1 perlldap AuthenSASL ] - ++ optional (!stdenv.isDarwin) finger_bsd - ++ optional (abook != null) abook - ++ optional (gnupg != null) gnupg - ++ optional (goobook != null) goobook - ++ optional (khard != null) khard - ++ optional (mu != null) mu; + buildInputs = [ goobook perl' ] + ++ lib.optional (!stdenv.isDarwin) finger_bsd + ++ lib.optional (abook != null) abook + ++ lib.optional (gnupg != null) gnupg + ++ lib.optional (goobook != null) goobook + ++ lib.optional (khard != null) khard + ++ lib.optional (mu != null) mu; + configureFlags = [ ] - ++ optional (abook != null) "--with-abook" - ++ optional (gnupg != null) "--with-gpg" - ++ optional (goobook != null) "--with-goobook" - ++ optional (khard != null) "--with-khard" - ++ optional (mu != null) "--with-mu"; + ++ lib.optional (abook != null) "--with-abook" + ++ lib.optional (gnupg != null) "--with-gpg" + ++ lib.optional (goobook != null) "--with-goobook" + ++ lib.optional (khard != null) "--with-khard" + ++ lib.optional (mu != null) "--with-mu"; patches = [ ./add-methods-to-rc.patch # fix undefined exec_prefix. Remove with the next release @@ -42,12 +41,8 @@ stdenv.mkDerivation { excludes = [ "debian/changelog" ]; }) ]; - postFixup = "wrapProgram $out/lib/mutt_ldap_query --prefix PERL5LIB : " - + "${AuthenSASL}/${perl.libPrefix}" - + ":${ConvertASN1}/${perl.libPrefix}" - + ":${perlldap}/${perl.libPrefix}"; - meta = { + meta = with lib; { homepage = "https://www.spinnaker.de/lbdb/"; license = licenses.gpl2; platforms = platforms.all; |