mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-20 19:16:11 +00:00
nrfutil: reinit at 7.11.1
This commit is contained in:
parent
6a3eb966a4
commit
3289ebc9ea
59
pkgs/by-name/nr/nrfutil/package.nix
Normal file
59
pkgs/by-name/nr/nrfutil/package.nix
Normal file
@ -0,0 +1,59 @@
|
||||
{
|
||||
lib,
|
||||
stdenvNoCC,
|
||||
fetchurl,
|
||||
makeWrapper,
|
||||
libusb1,
|
||||
segger-jlink-headless,
|
||||
}:
|
||||
|
||||
let
|
||||
source = import ./source.nix;
|
||||
supported = removeAttrs source [ "version" ];
|
||||
|
||||
platform = supported.${stdenvNoCC.system} or (throw "unsupported platform ${stdenvNoCC.system}");
|
||||
|
||||
in
|
||||
stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
pname = "nrfutil";
|
||||
inherit (source) version;
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://developer.nordicsemi.com/.pc-tools/nrfutil/nrfutil-${platform.name}-${finalAttrs.version}.tar.gz";
|
||||
inherit (platform) hash;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out
|
||||
mv data/* $out/
|
||||
|
||||
wrapProgram $out/bin/nrfutil \
|
||||
--prefix LD_LIBRARY_PATH : "${
|
||||
lib.makeLibraryPath [
|
||||
segger-jlink-headless
|
||||
libusb1
|
||||
]
|
||||
}"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru.updateScript = ./update.sh;
|
||||
|
||||
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 = attrNames supported;
|
||||
maintainers = with maintainers; [ h7x4 ];
|
||||
mainProgram = "nrfutil";
|
||||
};
|
||||
})
|
15
pkgs/by-name/nr/nrfutil/source.nix
Normal file
15
pkgs/by-name/nr/nrfutil/source.nix
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
version = "7.11.1";
|
||||
x86_64-linux = {
|
||||
name = "x86_64-unknown-linux-gnu";
|
||||
hash = "sha256-faF/iA07wWiAuxeqEZciIYlnoWe4LKCtDxD0BwIyeYw=";
|
||||
};
|
||||
x86_64-darwin = {
|
||||
name = "x86_64-apple-darwin";
|
||||
hash = "sha256-EImYXMIvxPgzaGuAOWi4O6mG5S1awdGSX0HQgT1iHaI=";
|
||||
};
|
||||
aarch64-darwin = {
|
||||
name = "aarch64-apple-darwin";
|
||||
hash = "sha256-jgigeJRHH/c761wYGMHhtRHE59ms7obZPxiH5pKeoeQ=";
|
||||
};
|
||||
}
|
38
pkgs/by-name/nr/nrfutil/update.sh
Executable file
38
pkgs/by-name/nr/nrfutil/update.sh
Executable file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p jq nix nix-prefetch-github xq-xml
|
||||
|
||||
nixpkgs="$(git rev-parse --show-toplevel || (printf 'Could not find root of nixpkgs repo\nAre we running from within the nixpkgs git repo?\n' >&2; exit 1))"
|
||||
|
||||
narhash() {
|
||||
nix --extra-experimental-features nix-command store prefetch-file --json "$1" | jq -r .hash
|
||||
}
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
declare -A architectures
|
||||
declare -A versions
|
||||
declare -A hashes
|
||||
|
||||
architectures["x86_64-linux"]="x86_64-unknown-linux-gnu"
|
||||
architectures["x86_64-darwin"]="x86_64-apple-darwin"
|
||||
architectures["aarch64-darwin"]="aarch64-apple-darwin"
|
||||
|
||||
binary_list=$(curl "https://developer.nordicsemi.com/.pc-tools/nrfutil/" | xq -q "#files" | grep -o -E 'nrfutil-(x86_64|aarch64)-.*?.gz' | cut -d' ' -f 1)
|
||||
|
||||
for a in ${!architectures[@]}; do
|
||||
versions["$a"]=$(echo "$binary_list" | grep "${architectures[${a}]}" | sed -r "s/nrfutil-${architectures[${a}]}-(.*?).tar.gz/\\1/" | tail -n 1)
|
||||
echo "https://developer.nordicsemi.com/.pc-tools/nrfutil/nrfutil-${architectures[${a}]}-${versions[${a}]}.tar.gz"
|
||||
hashes["$a"]=$(narhash "https://developer.nordicsemi.com/.pc-tools/nrfutil/nrfutil-${architectures[${a}]}-${versions[${a}]}.tar.gz")
|
||||
done
|
||||
|
||||
{
|
||||
printf "{\n"
|
||||
printf " version = \"${versions["x86_64-linux"]}\";\n"
|
||||
for a in ${!architectures[@]}; do
|
||||
printf " ${a} = {\n"
|
||||
printf " name = \"${architectures[${a}]}\";\n"
|
||||
printf " hash = \"${hashes[${a}]}\";\n"
|
||||
printf " };\n"
|
||||
done
|
||||
printf "}\n"
|
||||
} > "${nixpkgs}/pkgs/by-name/nr/nrfutil/source.nix"
|
Loading…
Reference in New Issue
Block a user