about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/misc/nrfutil/default.nix
blob: 7ffd92451bf5688ef70d738b66231f210e96ad4c (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
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
73
74
{ lib
, stdenv
, fetchFromGitHub
, pkgs
, python3
, python3Packages
}:
let
  py = python3.override {
    packageOverrides = self: super: {

      libusb1 = super.libusb1.overridePythonAttrs (oldAttrs: rec {
        version = "1.9.3";
        src = oldAttrs.src.override {
          inherit version;
          sha256 = "0j8p7jb7sibiiib18vyv3w5rrk0f4d2dl99bs18nwkq6pqvwxrk0";
        };

        postPatch = ''
          substituteInPlace usb1/libusb1.py --replace \
            "ctypes.util.find_library(base_name)" \
            "'${pkgs.libusb1}/lib/libusb-1.0${stdenv.hostPlatform.extensions.sharedLibrary}'"
        '';
      });
    };
  };
in
with py.pkgs;

buildPythonApplication rec {
  pname = "nrfutil";
  version = "6.1.3";

  src = fetchFromGitHub {
    owner = "NordicSemiconductor";
    repo = "pc-nrfutil";
    rev = "v${version}";
    sha256 = "1gpxjdcjn4rjvk649vpkh563c7lx3rrfvamazb1qjii1pxrvvqa7";
  };

  propagatedBuildInputs = [
    click
    crcmod
    ecdsa
    libusb1
    intelhex
    pc-ble-driver-py
    piccata
    protobuf
    pyserial
    pyspinel
    pyyaml
    tqdm
  ];

  checkInputs = [
    behave
    nose
  ];

  postPatch = ''
    mkdir test-reports
  '';

  meta = with lib; {
    description = "Device Firmware Update tool for nRF chips";
    homepage = "https://github.com/NordicSemiconductor/pc-nrfutil";
    license = licenses.unfreeRedistributable;
    platforms = platforms.unix;
    maintainers = with maintainers; [ gebner ];
    # libusb1 1.9.3 uses setuptools' 2to3 translation feature, which has been removed in setuptools 58
    broken = true;
  };
}