about summary refs log tree commit diff
path: root/pkgs/tools/filesystems/dduper
diff options
context:
space:
mode:
authorTheSola10 <me@thesola.io>2021-05-15 12:43:58 +0200
committerTheSola10 <me@thesola.io>2021-05-18 12:04:49 +0200
commitec2c8dfc2bd06c9001d7a1144228e143031737b9 (patch)
treec450c00768505bb93c2eb5b9201f88f33481fa0f /pkgs/tools/filesystems/dduper
parent83d907fd760d9ee4f49b4b7e4b1c6682f137b573 (diff)
dduper: init at v0.04
Diffstat (limited to 'pkgs/tools/filesystems/dduper')
-rw-r--r--pkgs/tools/filesystems/dduper/default.nix50
1 files changed, 50 insertions, 0 deletions
diff --git a/pkgs/tools/filesystems/dduper/default.nix b/pkgs/tools/filesystems/dduper/default.nix
new file mode 100644
index 0000000000000..5d91e8d0dcc6a
--- /dev/null
+++ b/pkgs/tools/filesystems/dduper/default.nix
@@ -0,0 +1,50 @@
+{ lib, stdenv, fetchpatch, fetchFromGitHub, btrfs-progs, python3 }:
+
+let
+  btrfsProgsPatched = btrfs-progs.overrideAttrs (oldAttrs: {
+    patches = [
+      (fetchpatch {
+        name = "0001-Print-csum-for-a-given-file-on-stdout.patch";
+        url = "https://raw.githubusercontent.com/Lakshmipathi/dduper/8fab08e0f1901bf54411d25f1767b48c978074cb/patch/btrfs-progs-v5.9/0001-Print-csum-for-a-given-file-on-stdout.patch";
+        sha256 = "1li9lslrap70ibad8sij3bgpxn5lqs0j10l60bmy3c36y866q3g1";
+      })
+    ];
+  });
+  py3 = python3.withPackages (ps: with ps; [
+    prettytable
+    numpy
+  ]);
+in
+stdenv.mkDerivation rec {
+  pname = "dduper";
+  version = "0.04";
+
+  src = fetchFromGitHub {
+    owner = "lakshmipathi";
+    repo = "dduper";
+    rev = "v${version}";
+    sha256 = "09ncdawxkffldadqhfblqlkdl05q2qmywxyg6p61fv3dr2f2v5wm";
+  };
+
+  buildInputs = [
+    btrfsProgsPatched
+    py3
+  ];
+
+  patchPhase = ''
+    substituteInPlace ./dduper --replace "/usr/sbin/btrfs.static" "${btrfsProgsPatched}/bin/btrfs"
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin
+    install -m755 ./dduper $out/bin
+  '';
+
+  meta = with lib; {
+    description = "Fast block-level out-of-band BTRFS deduplication tool.";
+    homepage = "https://github.com/Lakshmipathi/dduper";
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ thesola10 ];
+    platforms = platforms.linux;
+  };
+}