summary refs log tree commit diff
path: root/pkgs/tools/filesystems/ubidump/default.nix
blob: 6a6409ad3251cc993ada465c2ac7ed2321cbc1a2 (plain) (blame)
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
{ lib, fetchFromGitHub, python3, makeWrapper }:

python3.pkgs.buildPythonApplication rec {

  pname = "ubidump";
  version = "unstable-2019-09-11";

  src = fetchFromGitHub {
    owner = "nlitsme";
    repo = pname;
    rev = "0691f1a9a38604c2baf8c9af6b826eb2632af74a";
    sha256 = "1hiivlgni4r3nd5n2rzl5qzw6y2wpjpmyls5lybrc8imd6rmj3w2";
  };

  propagatedBuildInputs = with python3.pkgs; [ crcmod python-lzo ];

  phases = [ "unpackPhase" "patchPhase" "installPhase" "installCheckPhase" ];

  patchPhase = ''
    sed -i '1s;^;#!${python3.interpreter}\n;' ubidump.py
    patchShebangs ubidump.py
  '';

  installPhase = ''
    install -D -m755 ubidump.py $out/bin/ubidump
    wrapProgram $out/bin/ubidump --set PYTHONPATH $PYTHONPATH
  '';

  installCheckPhase = ''
    $out/bin/ubidump -h  > /dev/null
  '';

  meta = with lib; {
    description = "View or extract the contents of UBIFS images";
    homepage = "https://github.com/nlitsme/ubidump";
    license = licenses.mit;
    maintainers = with maintainers; [ sgo ];
  };
}