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