summaryrefslogtreecommitdiff
path: root/pkgs/by-name/uu/uuu/package.nix
blob: 5f6bdfe368bf89d21d3279c35a54dd58270e9493 (about) (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
{
  lib,
  stdenv,
  fetchFromGitHub,
  nix-update-script,

  cmake,
  installShellFiles,
  pkg-config,

  bzip2,
  libusb1,
  openssl,
  tinyxml-2,
  zlib,
  zstd,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "uuu";
  version = "1.5.191";

  src = fetchFromGitHub {
    owner = "nxp-imx";
    repo = "mfgtools";
    rev = "uuu_${finalAttrs.version}";
    hash = "sha256-t9SvQrOpcJ646WyUqX//4Rv7M8Ix2NbjgAAlrR0e31E=";
  };

  passthru.updateScript = nix-update-script {
    extraArgs = [
      "--version-regex"
      "uuu_\\([0-9.]+\\)"
    ];
  };

  nativeBuildInputs = [
    cmake
    installShellFiles
    pkg-config
  ];

  buildInputs = [
    bzip2
    libusb1
    openssl
    tinyxml-2
    zlib
    zstd
  ];

  postPatch = ''
    # Avoid the need of calling Git during the build.
    echo "uuu_${finalAttrs.version}" > .tarball-version
  '';

  postInstall = ''
    installShellCompletion --bash --name uuu.bash ${./completion.bash}

    mkdir -p $out/lib/udev/rules.d
    cat <($out/bin/uuu -udev) > $out/lib/udev/rules.d/70-uuu.rules
  '';

  meta = with lib; {
    description = "Freescale/NXP I.MX Chip image deploy tools";
    homepage = "https://github.com/nxp-imx/mfgtools";
    license = licenses.bsd3;
    maintainers = with maintainers; [ otavio ];
    mainProgram = "uuu";
    platforms = platforms.all;
  };
})