nixpkgs/pkgs/tools/backup/znapzend/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

88 lines
2.9 KiB
Nix

{ lib, stdenv, fetchFromGitHub, fetchurl, perl, perlPackages, wget, autoconf, automake, autoreconfHook }:
let
# when upgrade znapzend, check versions of Perl libs here: https://github.com/oetiker/znapzend/blob/master/cpanfile
# pinned versions are listed at https://github.com/oetiker/znapzend/blob/master/thirdparty/cpanfile-5.26.1.snapshot
Mojolicious-8-35 = perlPackages.buildPerlPackage rec {
pname = "Mojolicious";
version = "8.35";
src = fetchurl {
url = "mirror://cpan/authors/id/S/SR/SRI/${pname}-${version}.tar.gz";
sha256 = "1bll0ahh5v1y3x0ql29klwsa68cj46wzqc385srsnn2m8kh2ak8h";
};
};
MojoIOLoopForkCall-0-20 = perlPackages.buildPerlModule rec {
pname = "Mojo-IOLoop-ForkCall";
version = "0.20";
src = fetchurl {
url = "mirror://cpan/authors/id/J/JB/JBERGER/${pname}-${version}.tar.gz";
sha256 = "19pih5x0ayxs2m8j29qwdpi6ky3w4ghv6vrmax3ix9r59hj6569b";
};
propagatedBuildInputs = [ perlPackages.IOPipely Mojolicious-8-35 ];
};
version = "0.20.0";
checksum = "15lb5qwksa508m9bj6d3n4rrjpakfaas9qxspg408bcqfp7pqjw3";
in
stdenv.mkDerivation {
pname = "znapzend";
inherit version;
src = fetchFromGitHub {
owner = "oetiker";
repo = "znapzend";
rev = "v${version}";
sha256 = checksum;
};
buildInputs = [ wget perl MojoIOLoopForkCall-0-20 perlPackages.TAPParserSourceHandlerpgTAP ];
nativeBuildInputs = [ autoconf automake autoreconfHook ];
preConfigure = ''
sed -i 's/^SUBDIRS =.*$/SUBDIRS = lib/' Makefile.am
grep -v thirdparty/Makefile configure.ac > configure.ac.tmp
mv configure.ac.tmp configure.ac
autoconf
'';
preBuild = ''
aclocal
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";
license = licenses.gpl3;
maintainers = with maintainers; [ otwieracz ];
platforms = platforms.all;
};
}