1{ mkDerivation
2, lib, stdenv
3, fetchurl
4, ncurses
5, libuuid
6, pkg-config
7, libjpeg
8, zlib
9, libewf
10, enableNtfs ? !stdenv.isDarwin, ntfs3g ? null
11, enableExtFs ? !stdenv.isDarwin, e2fsprogs ? null
12, enableQt ? false, qtbase ? null, qttools ? null, qwt ? null
13}:
14
15assert enableNtfs -> ntfs3g != null;
16assert enableExtFs -> e2fsprogs != null;
17assert enableQt -> qtbase != null;
18assert enableQt -> qttools != null;
19assert enableQt -> qwt != null;
20
21(if enableQt then mkDerivation else stdenv.mkDerivation) rec {
22 pname = "testdisk";
23 version = "7.1";
24 src = fetchurl {
25 url = "https://www.cgsecurity.org/testdisk-${version}.tar.bz2";
26 sha256 = "1zlh44w67py416hkvw6nrfmjickc2d43v51vcli5p374d5sw84ql";
27 };
28
29 enableParallelBuilding = true;
30
31 buildInputs = [
32 ncurses
33 libuuid
34 libjpeg
35 zlib
36 libewf
37 ]
38 ++ lib.optional enableNtfs ntfs3g
39 ++ lib.optional enableExtFs e2fsprogs
40 ++ lib.optionals enableQt [ qtbase qttools qwt ];
41
42 nativeBuildInputs = [ pkg-config ];
43
44 env.NIX_CFLAGS_COMPILE = "-Wno-unused";
45
46 meta = with lib; {
47 homepage = "https://www.cgsecurity.org/wiki/Main_Page";
48 downloadPage = "https://www.cgsecurity.org/wiki/TestDisk_Download";
49 description = "Data recovery utilities";
50 longDescription = ''
51 TestDisk is a powerful free data recovery software. It was primarily
52 designed to help recover lost partitions and/or make non-booting disks
53 bootable again when these symptoms are caused by faulty software: certain
54 types of viruses or human error (such as accidentally deleting a
55 Partition Table).
56
57 PhotoRec is a file data recovery software designed to recover lost files
58 including video, documents and archives from hard disks, CD-ROMs, and
59 lost pictures (thus the Photo Recovery name) from digital camera memory.
60 PhotoRec ignores the file system and goes after the underlying data, so
61 it will still work even if your media's file system has been severely
62 damaged or reformatted.
63 '';
64 license = lib.licenses.gpl2Plus;
65 platforms = lib.platforms.all;
66 maintainers = with maintainers; [ fgaz eelco ];
67 };
68}