1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p jq nix nix-prefetch-github
4 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))"
7 nix
--extra-experimental-features nix-command store prefetch-file
--json "$1" | jq
-r .
hash
12 declare -A architectures
16 architectures
["x86_64-linux"]="x86_64-unknown-linux-gnu"
17 architectures
["x86_64-darwin"]="x86_64-apple-darwin"
18 architectures
["aarch64-darwin"]="aarch64-apple-darwin"
20 BASE_URL
="https://files.nordicsemi.com/artifactory/swtools/external/nrfutil"
22 for a
in ${!architectures[@]}; do
23 versions
["$a"]=$
(curl
"$BASE_URL/index/${architectures[${a}]}/index.json" | jq
-r '.packages.nrfutil.latest_version')
24 hashes
["$a"]=$
(narhash
"$BASE_URL/packages/nrfutil/nrfutil-${architectures[${a}]}-${versions[${a}]}.tar.gz")
29 printf " version = \"${versions["x86_64-linux"]}\";\n"
30 for a
in ${!architectures[@]}; do
32 printf " name = \"${architectures[${a}]}\";\n"
33 printf " hash = \"${hashes[${a}]}\";\n"
37 } > "${nixpkgs}/pkgs/by-name/nr/nrfutil/source.nix"