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/backup/znapzend | |
parent | 3966039910db296c1c2dca2120ab0976952fe11c (diff) | |
download | nixpkgs-61b7cab4811e0e90937bcc8b4c1ca32b387c895c.tar nixpkgs-61b7cab4811e0e90937bcc8b4c1ca32b387c895c.tar.gz nixpkgs-61b7cab4811e0e90937bcc8b4c1ca32b387c895c.tar.bz2 nixpkgs-61b7cab4811e0e90937bcc8b4c1ca32b387c895c.tar.lz nixpkgs-61b7cab4811e0e90937bcc8b4c1ca32b387c895c.tar.xz nixpkgs-61b7cab4811e0e90937bcc8b4c1ca32b387c895c.tar.zst nixpkgs-61b7cab4811e0e90937bcc8b4c1ca32b387c895c.zip |
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/backup/znapzend')
-rw-r--r-- | pkgs/tools/backup/znapzend/default.nix | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/pkgs/tools/backup/znapzend/default.nix b/pkgs/tools/backup/znapzend/default.nix index 1e4e84b445b..9c3e4fca95d 100644 --- a/pkgs/tools/backup/znapzend/default.nix +++ b/pkgs/tools/backup/znapzend/default.nix @@ -21,6 +21,11 @@ let propagatedBuildInputs = [ perlPackages.IOPipely Mojolicious-8-35 ]; }; + perl' = perl.withPackages (p: + [ MojoIOLoopForkCall-0-20 + p.TAPParserSourceHandlerpgTAP + ]); + version = "0.20.0"; checksum = "15lb5qwksa508m9bj6d3n4rrjpakfaas9qxspg408bcqfp7pqjw3"; in @@ -35,7 +40,7 @@ stdenv.mkDerivation { sha256 = checksum; }; - buildInputs = [ wget perl MojoIOLoopForkCall-0-20 perlPackages.TAPParserSourceHandlerpgTAP ]; + buildInputs = [ wget perl' ]; nativeBuildInputs = [ autoconf automake autoreconfHook ]; @@ -53,30 +58,6 @@ stdenv.mkDerivation { automake ''; - postInstall = '' - substituteInPlace $out/bin/znapzend --replace "${perl}/bin/perl" \ - "${perl}/bin/perl \ - -I${Mojolicious-8-35}/${perl.libPrefix} \ - -I${perlPackages.TAPParserSourceHandlerpgTAP}/${perl.libPrefix} \ - -I${MojoIOLoopForkCall-0-20}/${perl.libPrefix} \ - -I${perlPackages.IOPipely}/${perl.libPrefix} \ - " - substituteInPlace $out/bin/znapzendzetup --replace "${perl}/bin/perl" \ - "${perl}/bin/perl \ - -I${Mojolicious-8-35}/${perl.libPrefix} \ - -I${perlPackages.TAPParserSourceHandlerpgTAP}/${perl.libPrefix} \ - -I${MojoIOLoopForkCall-0-20}/${perl.libPrefix} \ - -I${perlPackages.IOPipely}/${perl.libPrefix} \ - " - substituteInPlace $out/bin/znapzendztatz --replace "${perl}/bin/perl" \ - "${perl}/bin/perl \ - -I${Mojolicious-8-35}/${perl.libPrefix} \ - -I${perlPackages.TAPParserSourceHandlerpgTAP}/${perl.libPrefix} \ - -I${MojoIOLoopForkCall-0-20}/${perl.libPrefix} \ - -I${perlPackages.IOPipely}/${perl.libPrefix} \ - " - ''; - meta = with lib; { description = "High performance open source ZFS backup with mbuffer and ssh support"; homepage = "http://www.znapzend.org"; |