summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/du/dumpifs/package.nix
blob: 8009e51c7f2bc2cb4b7e3f2fdbf18f6ad1aa465b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{
  clang,
  fetchFromGitHub,
  lib,
  lzo,
  lz4,
  stdenv,
  ucl,
  unstableGitUpdater,
  zlib,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "dumpifs";
  version = "0-unstable-2020-05-07";

  src = fetchFromGitHub {
    owner = "askac";
    repo = "dumpifs";
    rev = "b7bac90e8312eca2796f2003a52791899eb8dcd9";
    hash = "sha256-vFiMKcPfowLQQZXlXbq5ZR1X6zr7u3iQwz3o4A6aQMY=";
  };

  nativeBuildInputs = [ clang ];

  buildInputs = [
    lzo
    lz4
    ucl
    zlib
  ];

  postUnpack = ''
    rm ${finalAttrs.src.name}/{dumpifs,exMifsLzo,uuu,zzz}
  '';

  patches = [ ./package.patch ];

  installPhase = ''
    runHook preInstall

    install -Dm755 dumpifs exMifsLz4 exMifsLzo fixdecifs fixencifs uuu zzz -t $out/bin

    runHook postInstall
  '';

  passthru.updateScript = unstableGitUpdater { };

  meta = {
    description = "Tool for those who are interested in hacking MIB2 firmware";
    homepage = "https://github.com/askac/dumpifs";
    platforms = lib.platforms.unix;
    mainProgram = "dumpifs";
    license = lib.licenses.unfree;
  };
})