aerospike: 8.0.0.1 -> 8.0.0.2 (#380565)
[NixPkgs.git] / pkgs / by-name / bt / btrbk / package.nix
blobdad8be36e5947d066be22b827eb4dc10cca74eaf
2   lib,
3   stdenv,
4   fetchurl,
5   bash,
6   btrfs-progs,
7   openssh,
8   perl,
9   perlPackages,
10   util-linux,
11   asciidoctor,
12   mbuffer,
13   makeWrapper,
14   genericUpdater,
15   curl,
16   writeShellScript,
17   nixosTests,
20 stdenv.mkDerivation rec {
21   pname = "btrbk";
22   version = "0.32.6";
24   src = fetchurl {
25     url = "https://digint.ch/download/btrbk/releases/${pname}-${version}.tar.xz";
26     sha256 = "AuKsZHyRhGMgLL5ge7lVV6T3/SNwaRJDM8VNpbK7t2s=";
27   };
29   nativeBuildInputs = [
30     asciidoctor
31     makeWrapper
32   ];
34   buildInputs = with perlPackages; [
35     perl
36     DateCalc
37   ];
39   preInstall = ''
40     for f in $(find . -name Makefile); do
41       substituteInPlace "$f" \
42         --replace "/usr" "$out" \
43         --replace "/etc" "$out/etc"
44     done
46     # Tainted Mode disables PERL5LIB
47     substituteInPlace btrbk \
48       --replace "perl -T" "perl" \
49       --replace "\$0" "\$ENV{'program_name'}"
51     # Fix SSH filter script
52     sed -i '/^export PATH/d' ssh_filter_btrbk.sh
53     substituteInPlace ssh_filter_btrbk.sh --replace logger ${util-linux}/bin/logger
54   '';
56   preFixup = ''
57     wrapProgram $out/bin/btrbk \
58       --set PERL5LIB $PERL5LIB \
59       --run 'export program_name=$0' \
60       --prefix PATH ':' "${
61         lib.makeBinPath [
62           btrfs-progs
63           bash
64           mbuffer
65           openssh
66         ]
67       }"
68   '';
70   passthru.tests = {
71     inherit (nixosTests)
72       btrbk
73       btrbk-no-timer
74       btrbk-section-order
75       btrbk-doas
76       ;
77   };
79   passthru.updateScript = genericUpdater {
80     versionLister = writeShellScript "btrbk-versionLister" ''
81       ${curl}/bin/curl -s https://digint.ch/download/btrbk/releases/ | ${perl}/bin/perl -lne 'print $1 if /btrbk-([0-9.]*)\.tar/'
82     '';
83   };
85   meta = with lib; {
86     description = "Backup tool for btrfs subvolumes";
87     homepage = "https://digint.ch/btrbk";
88     license = licenses.gpl3Only;
89     platforms = platforms.unix;
90     maintainers = with maintainers; [ asymmetric ];
91     mainProgram = "btrbk";
92   };