1{ stdenv
2, lib
3, fetchFromGitHub
4, parted
5, systemd
6, argp-standalone
7}:
8
9stdenv.mkDerivation rec {
10 pname = "f3";
11 version = "8.0";
12
13 src = fetchFromGitHub {
14 owner = "AltraMayor";
15 repo = pname;
16 rev = "v${version}";
17 sha256 = "17l5vspfcgfbkqg7bakp3gql29yb05gzawm8n3im30ilzdr53678";
18 };
19
20 postPatch = ''
21 sed -i 's/-oroot -groot//' Makefile
22
23 for f in f3write.h2w log-f3wr; do
24 substituteInPlace $f \
25 --replace '$(dirname $0)' $out/bin
26 done
27 '';
28
29 buildInputs = lib.optionals stdenv.isLinux [ systemd parted ]
30 ++ lib.optionals stdenv.isDarwin [ argp-standalone ];
31
32 buildFlags = [
33 "all" # f3read, f3write
34 ]
35 ++ lib.optional stdenv.isLinux "extra"; # f3brew, f3fix, f3probe
36
37 installFlags = [
38 "PREFIX=${placeholder "out"}"
39 ];
40
41 installTargets = [
42 "install"
43 ]
44 ++ lib.optional stdenv.isLinux "install-extra";
45
46 postInstall = ''
47 install -Dm555 -t $out/bin f3write.h2w log-f3wr
48 install -Dm444 -t $out/share/doc/${pname} LICENSE README.rst
49 '';
50
51 meta = with lib; {
52 description = "Fight Flash Fraud";
53 homepage = "https://fight-flash-fraud.readthedocs.io/en/stable/";
54 license = licenses.gpl3Plus;
55 maintainers = with maintainers; [ makefu evils ];
56 };
57}