1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 libbsd,
6 libgcrypt,
7 xxHash,
8 pkg-config,
9 glib,
10 linuxHeaders ? stdenv.cc.libc.linuxHeaders,
11 sqlite,
12 util-linux,
13 testers,
14 duperemove,
15}:
16
17stdenv.mkDerivation rec {
18 pname = "duperemove";
19 version = "0.15.2";
20
21 src = fetchFromGitHub {
22 owner = "markfasheh";
23 repo = "duperemove";
24 rev = "v${version}";
25 hash = "sha256-Y3HIqq61bLfZi4XR2RtSyuCPmcWrTxeWvqpTh+3hUjc=";
26 };
27
28 postPatch = ''
29 substituteInPlace util.c --replace \
30 "lscpu" "${lib.getBin util-linux}/bin/lscpu"
31 '';
32
33 nativeBuildInputs = [ pkg-config ];
34 buildInputs = [
35 libbsd
36 libgcrypt
37 glib
38 linuxHeaders
39 sqlite
40 util-linux
41 xxHash
42 ];
43
44 makeFlags = [
45 "PREFIX=${placeholder "out"}"
46 "VERSION=v${version}"
47 ];
48
49 passthru.tests.version = testers.testVersion {
50 package = duperemove;
51 command = "duperemove --version";
52 version = "v${version}";
53 };
54
55 meta = with lib; {
56 description = "Simple tool for finding duplicated extents and submitting them for deduplication";
57 homepage = "https://github.com/markfasheh/duperemove";
58 license = licenses.gpl2Only;
59 maintainers = with maintainers; [
60 thoughtpolice
61 ];
62 platforms = platforms.linux;
63 mainProgram = "duperemove";
64 };
65}