Unverified Commit df05dcce authored by h7x4's avatar h7x4 Committed by GitHub
Browse files

nrfutil: 7.13.0 -> 8.1.1, package all installables (#440671)

parents 83baa28a 631d512b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ lhapdf.section.md
locales.section.md
etc-files.section.md
nginx.section.md
nrfutil.section.md
opengl.section.md
shell-helpers.section.md
python-tree-sitter.section.md
+13 −0
Original line number Diff line number Diff line
# nrfutil {#sec-nrfutil}

nrfutil can be built with its installables as following:

```nix
(nrfutil.withExtensions [
  "nrfutil-completion"
  "nrfutil-device"
  "nrfutil-trace"
])
```

Keep in mind that all installables might not be available for every supported platform.
+3 −0
Original line number Diff line number Diff line
@@ -325,6 +325,9 @@
  "sec-nixpkgs-release-25.05-notable-changes": [
    "release-notes.html#sec-nixpkgs-release-25.05-notable-changes"
  ],
  "sec-nrfutil": [
    "index.html#sec-nrfutil"
  ],
  "sec-overlays-install": [
    "index.html#sec-overlays-install"
  ],
+122 −43
Original line number Diff line number Diff line
@@ -2,28 +2,55 @@
  lib,
  stdenvNoCC,
  fetchurl,

  xz,
  zlib,
  libusb1,
  segger-jlink-headless,
  gcc,

  autoPatchelfHook,
  versionCheckHook,
  makeWrapper,
  installShellFiles,

  symlinkJoin,
  extensions ? [ ],
  nrfutil,
}:

let
  source = import ./source.nix;
  supported = removeAttrs source [ "version" ];
  sources = import ./source.nix;
  platformSources =
    sources.${stdenvNoCC.system} or (throw "unsupported platform ${stdenvNoCC.system}");

  platform = supported.${stdenvNoCC.system} or (throw "unsupported platform ${stdenvNoCC.system}");
  sharedMeta = with lib; {
    description = "CLI tool for managing Nordic Semiconductor devices";
    homepage = "https://www.nordicsemi.com/Products/Development-tools/nRF-Util";
    changelog = "https://docs.nordicsemi.com/bundle/nrfutil/page/guides/revision_history.html";
    license = licenses.unfree;
    platforms = lib.attrNames sources;
    sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
    maintainers = with maintainers; [
      h7x4
      ezrizhu
    ];
  };

  packages =
    map
      (
        name:
        let
          package = platformSources.packages.${name};
        in
        stdenvNoCC.mkDerivation (finalAttrs: {
  pname = "nrfutil";
  inherit (source) version;
          pname = name;
          inherit (package) version;

          src = fetchurl {
    url = "https://files.nordicsemi.com/artifactory/swtools/external/nrfutil/packages/nrfutil/nrfutil-${platform.name}-${finalAttrs.version}.tar.gz";
    inherit (platform) hash;
            url = "https://files.nordicsemi.com/artifactory/swtools/external/nrfutil/packages/${name}/${name}-${platformSources.triplet}-${package.version}.tar.gz";
            inherit (package) hash;
          };

          nativeBuildInputs = [
@@ -31,6 +58,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
          ];

          buildInputs = [
            xz
            zlib
            libusb1
            gcc.cc.lib
@@ -53,18 +81,69 @@ stdenvNoCC.mkDerivation (finalAttrs: {
          nativeInstallCheckInputs = [
            versionCheckHook
          ];
  passthru.updateScript = ./update.sh;
          versionCheckProgramArg = "--version";

  meta = with lib; {
    description = "CLI tool for managing Nordic Semiconductor devices";
    homepage = "https://www.nordicsemi.com/Products/Development-tools/nRF-Util";
    changelog = "https://docs.nordicsemi.com/bundle/nrfutil/page/guides/revision_history.html";
    license = licenses.unfree;
    platforms = lib.attrNames supported;
    maintainers = with maintainers; [
      h7x4
      ezrizhu
          meta = sharedMeta // {
            mainProgram = name;
          };
        })
      )
      (
        [
          "nrfutil"
          "nrfutil-completion"
        ]
        ++ extensions
      );

in
symlinkJoin {
  pname = "nrfutil";
  inherit (platformSources.packages.nrfutil) version;

  paths = packages;

  nativeBuildInputs = [
    makeWrapper
    installShellFiles
  ];

  postBuild =
    let
      wrapProgramArgs = lib.concatStringsSep " " (
        [
          ''--prefix PATH : "$out/bin"''
          ''--prefix PATH : "$out"/lib/nrfutil-npm''
          ''--prefix PATH : "$out"/lib/nrfutil-nrf5sdk-tools''
          ''--set NRF_JLINK_DLL_PATH '${segger-jlink-headless}'/lib/libjlinkarm.so''
          ''--set NRFUTIL_BLE_SNIFFER_SHIM_BIN_ENV "$out"/lib/nrfutil-ble-sniffer/wireshark-shim''
          ''--set NRFUTIL_BLE_SNIFFER_HCI_SHIM_BIN_ENV "$out"/lib/nrfutil-ble-sniffer/wireshark-hci-shim''
        ]
        ++ (
          let
            # These are the extensions with the probe-plugin-worker executable vendored.
            relevantExtensions = lib.intersectLists [ "nrfutil-device" "nrfutil-trace" ] extensions;
          in
          lib.optionals (relevantExtensions != [ ]) [
            ''--set NRF_PROBE_PATH "$out"/lib/${lib.head relevantExtensions}''
          ]
        )
      );
    in
    ''
      wrapProgram "$out"/bin/nrfutil ${wrapProgramArgs}

      installShellCompletion --cmd nrfutil \
        --bash $(realpath "$out"/share/nrfutil-completion/scripts/bash/setup.bash) \
        --zsh $(realpath "$out"/share/nrfutil-completion/scripts/zsh/_nrfutil)
    '';

  passthru = {
    updateScript = ./update.sh;
    withExtensions = extensions: nrfutil.override { inherit extensions; };
  };

  meta = sharedMeta // {
    mainProgram = "nrfutil";
  };
})
}
+80 −3
Original line number Diff line number Diff line
{
  version = "7.13.0";
  aarch64-linux = {
    triplet = "aarch64-unknown-linux-gnu";
    packages = {
      nrfutil = {
        version = "8.1.1";
        hash = "sha256-y7ywCr9Ze3Uz1JQh0hNg2BOPKW2yEftYDaD8WzHWSxY=";
      };
      nrfutil-ble-sniffer = {
        version = "0.16.2";
        hash = "sha256-vCpSs9oUcqKPDKVoEtrqqY9Jy0AtbMwK8s398xvQ7Us=";
      };
      nrfutil-device = {
        version = "2.15.1";
        hash = "sha256-u8JlM7bxkR5x0fhTQRIkElpxot6jpKyL2SljFfoKj54=";
      };
      nrfutil-mcu-manager = {
        version = "0.8.0";
        hash = "sha256-jLsLN/Ny5zL4MSaKS3cb2L4WBCKZHVLiR2RkPAL8JnY=";
      };
      nrfutil-sdk-manager = {
        version = "1.8.0";
        hash = "sha256-DsGuOQ6rzwit5oeG4ZLObCOaxMt8WB+YYnuXRYtqq4U=";
      };
      nrfutil-trace = {
        version = "4.0.1";
        hash = "sha256-IR4P1tK/0P3d96Wnwciq7b3TJurENF2pYKaHu2yZIPk=";
      };
    };
  };
  x86_64-linux = {
    name = "x86_64-unknown-linux-gnu";
    hash = "sha256-R3OF/340xEab+0zamfwvejY16fjy/3TrzMvQaBlVxHw=";
    triplet = "x86_64-unknown-linux-gnu";
    packages = {
      nrfutil = {
        version = "8.1.1";
        hash = "sha256-asX1UbAE6X03lLC3l9e/9G2WgVRezfmRD6dyXJKb18Y=";
      };
      nrfutil-91 = {
        version = "0.5.0";
        hash = "sha256-ACQ+csYVIoANKV+CyAAD+drXQSb7CVUdvDYe76LELqs=";
      };
      nrfutil-ble-sniffer = {
        version = "0.16.2";
        hash = "sha256-4TGbn0HdlER5k76Hc5rCSVvyx89VdLQ56fMiGgWUvrU=";
      };
      nrfutil-completion = {
        version = "1.5.0";
        hash = "sha256-KA5h9/hJA66nkAAW1Tui+m60E/Iv9wzVPdeQqIQWpxc=";
      };
      nrfutil-device = {
        version = "2.15.1";
        hash = "sha256-zH/QtM1vM6BIiZHPLM23TRt2LCRUdJvmYN9oveotsH0=";
      };
      nrfutil-mcu-manager = {
        version = "0.8.0";
        hash = "sha256-ItU3kys1HMd06srLTzPtRoAW1YxwOt39LqjIQPMvmaI=";
      };
      nrfutil-npm = {
        version = "0.3.1";
        hash = "sha256-kQ63fVWR8RdGTQLA27Sg7jegYhtlkvXvLJsucifH4I0=";
      };
      nrfutil-nrf5sdk-tools = {
        version = "1.1.0";
        hash = "sha256-hLQhTEa5F2lrFxppKmVrD5PnIA3JPcP/M/r9bYizHk8=";
      };
      nrfutil-sdk-manager = {
        version = "1.8.0";
        hash = "sha256-+Z1xfEdTAcvYj+hjsW0z/dHRoIzVGWXjD6lSqoQvOPg=";
      };
      nrfutil-suit = {
        version = "0.9.0";
        hash = "sha256-uwbUgjpJNC27bSINyhfzTrOXIUi7GjFnPebg38apRKc=";
      };
      nrfutil-toolchain-manager = {
        version = "0.15.0";
        hash = "sha256-/bQx4yu1ybCO2TBd7MctxCANiYO5c1qCDYSjXm7hLcE=";
      };
      nrfutil-trace = {
        version = "4.0.1";
        hash = "sha256-YmsMQOD1vylaRwMWOhOA9xXePJR779P8im4Lcs7EcWk=";
      };
    };
  };
}
Loading