2024-03-16 17:00:22 -04:00
|
|
|
{ writeShellApplication
|
|
|
|
, git
|
2024-06-03 03:50:23 -04:00
|
|
|
, npins
|
2024-03-16 17:00:22 -04:00
|
|
|
, nix
|
|
|
|
, ripgrep
|
|
|
|
, coreutils
|
2024-04-03 19:51:03 -04:00
|
|
|
, jq
|
2024-03-16 17:00:22 -04:00
|
|
|
}:
|
2024-06-03 03:50:23 -04:00
|
|
|
# add or update Nixpkgs releases using `npins`
|
2024-03-16 17:00:22 -04:00
|
|
|
writeShellApplication {
|
|
|
|
name = "update-nixpkgs-releases";
|
2024-06-03 03:50:23 -04:00
|
|
|
runtimeInputs = [ git npins nix ripgrep jq coreutils ];
|
2024-03-16 17:00:22 -04:00
|
|
|
text = ''
|
2024-04-03 19:51:03 -04:00
|
|
|
echo >&2 "Updating rolling"
|
2024-06-03 03:50:23 -04:00
|
|
|
npins update nixpkgs-rolling
|
2024-04-03 19:51:03 -04:00
|
|
|
echo >&2 "Updating stable releases"
|
2024-06-03 03:50:23 -04:00
|
|
|
npins -d nix update
|
2024-03-16 17:00:22 -04:00
|
|
|
|
2024-04-03 19:51:03 -04:00
|
|
|
echo >&2 "Adding any new releases"
|
2024-03-16 17:00:22 -04:00
|
|
|
# get release branches
|
|
|
|
git ls-remote https://github.com/nixos/nixpkgs "refs/heads/*" \
|
2024-04-03 19:51:03 -04:00
|
|
|
| rg '^([0-9a-f]+)\trefs/heads/nixos-(\d\d\.\d\d)$' -or '$2' \
|
|
|
|
| sort --reverse --version-sort \
|
|
|
|
| while read -r version; do
|
2024-03-16 17:00:22 -04:00
|
|
|
|
2024-06-03 03:50:23 -04:00
|
|
|
if ! jq -e --arg version "$version" 'has($ARGS.named.version)' nix/sources.json >/dev/null; then
|
|
|
|
npins -d nix add --name "$version" github nixos nixpkgs --branch "nixos-$version"
|
2024-04-03 19:51:03 -04:00
|
|
|
fi
|
|
|
|
done
|
2024-03-16 17:00:22 -04:00
|
|
|
'';
|
|
|
|
}
|