@@ -0,0 +1,49 @@
1+{ stdenv, fetchFromGitHub, perl, which
2+, openssl, sqlite }:
3+
4+# Instead of writing directly into $HOME, we change the default db location
5+# from $HOME/.dupd_sqlite to $HOME/.cache/dupd.sqlite3
6+
7+stdenv.mkDerivation rec {
8+ pname = "dupd";
9+ version = "1.7";
10+
11+ src = fetchFromGitHub {
12+ owner = "jvirkki";
13+ repo = "dupd";
14+ rev = version;
15+ sha256 = "0vg4vbiwjc5p22cisj8970mym4y2r29fcm08ibik92786vsbxcqk";
16+ };
17+
18+ postPatch = ''
19+ patchShebangs tests
20+
21+ # tests need HOME to write the database
22+ export HOME=$TMPDIR
23+
24+ mkdir -p $HOME/.cache
25+
26+ for f in man/dupd man/dupd.1 src/main.c tests/test.56 tests/test.57 ; do
27+ substituteInPlace $f --replace .dupd_sqlite .cache/dupd.sqlite3
28+ done
29+ '';
30+
31+ buildInputs = [ openssl sqlite ];
32+
33+ nativeBuildInputs = [ perl which ];
34+
35+ makeFlags = [
36+ "INSTALL_PREFIX=$(out)"
37+ ];
38+
39+ enableParallelBuilding = true;
40+
41+ doCheck = true;
42+
43+ meta = with stdenv.lib; {
44+ description = "CLI utility to find duplicate files";
45+ homepage = http://www.virkki.com/dupd;
46+ license = licenses.gpl3;
47+ maintainers = with maintainers; [ peterhoeg ];
48+ };
49+}