Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib
2, stdenv
3, fetchurl
4, autoPatchelfHook
5, udev
6, libusb1
7, segger-jlink
8}:
9
10let
11 supported = {
12 x86_64-linux = {
13 name = "linux-amd64";
14 sha256 = "0e036afa51c83de7824ef75d34e165ed55efc486697b8ff105639644bce988e5";
15 };
16 i686-linux = {
17 name = "linux-i386";
18 sha256 = "ba208559ae1195a0d4342374a0eb79697d31d6b848d180ac906494f17f56623b";
19 };
20 aarch64-linux = {
21 name = "linux-arm64";
22 sha256 = "cffa4b8becdb5545705fd138422c648d809b520b7bc6c77b8b50aa1f79ebe845";
23 };
24 armv7l-linux = {
25 name = "linux-armhf";
26 sha256 = "c58d330152ae1ef588a5ee1d93777e18b341d4f6a2754642b0ddd41821050a3a";
27 };
28 };
29
30 platform = supported.${stdenv.system} or (throw "unsupported platform ${stdenv.system}");
31
32 version = "10.16.0";
33
34 url = "https://nsscprodmedia.blob.core.windows.net/prod/software-and-other-downloads/desktop-software/nrf-command-line-tools/sw/versions-${lib.versions.major version}-x-x/${lib.versions.major version}-${lib.versions.minor version}-${lib.versions.patch version}/nrf-command-line-tools-${lib.versions.major version}.${lib.versions.minor version}.${lib.versions.patch version}_${platform.name}.tar.gz";
35
36in stdenv.mkDerivation {
37 pname = "nrf-command-line-tools";
38 inherit version;
39
40 src = fetchurl {
41 inherit url;
42 inherit (platform) sha256;
43 };
44
45 runtimeDependencies = [ segger-jlink ];
46
47 nativeBuildInputs = [ autoPatchelfHook ];
48 buildInputs = [ udev libusb1 ];
49
50 dontConfigure = true;
51 dontBuild = true;
52
53 installPhase = ''
54 runHook preInstall
55
56 rm -rf ./python
57 mkdir -p $out
58 cp -r * $out
59
60 chmod +x $out/lib/*
61
62 runHook postInstall
63 '';
64
65 meta = with lib; {
66 description = "Nordic Semiconductor nRF Command Line Tools";
67 homepage = "https://www.nordicsemi.com/Products/Development-tools/nRF-Command-Line-Tools";
68 license = licenses.unfree;
69 platforms = attrNames supported;
70 maintainers = with maintainers; [ stargate01 ];
71 };
72}