1{ lib, stdenv, coreutils, gawk, fetchFromGitHub }:
2
3stdenv.mkDerivation rec {
4 pname = "rsbep";
5 version = "0.2.0";
6
7 src = fetchFromGitHub {
8 owner = "ttsiodras";
9 repo = "rsbep-backup";
10 rev = "v${version}";
11 sha256 = "0is4jgil3wdqbvx9h66xcyzbqy84ndyydnnay2g9k81a4mcz4dns";
12 };
13
14 postFixup = ''
15 cd $out/bin
16
17 # Move internal tool 'rsbep_chopper' to libexec
18 libexecDir=$out/libexec/rsbep
19 mkdir -p $libexecDir
20 mv rsbep_chopper $libexecDir
21
22 # Fix store dependencies in scripts
23 path="export PATH=$out/bin:$libexecDir:${lib.makeBinPath [ coreutils gawk ]}"
24 sed -i "2i$path" freeze.sh
25 sed -i "2i$path" melt.sh
26
27 # Remove unneded binary
28 rm poorZFS.py
29 '';
30
31 doInstallCheck = true;
32 installCheckPhase = ''
33 cd $TMP
34 echo hello > input
35 $out/bin/freeze.sh input > packed
36 $out/bin/melt.sh packed > output
37 diff -u input output
38 '';
39
40 meta = with lib; {
41 description = "Create resilient backups with Reed-Solomon error correction and byte-spreading";
42 homepage = "https://www.thanassis.space/rsbep.html";
43 license = licenses.gpl3Plus;
44 maintainers = [ maintainers.erikarvstedt ];
45 };
46}