mirror of
https://github.com/NixOS/nix.dev.git
synced 2024-10-18 14:32:43 -04:00
f4794639c6
- Use separate JSON files to track sources for Nixpkgs and Nix releases This greatly simplifies the code, because we can directly encode versions as keys without ambiguity - Avoid an instance of IFD for the redirect generation - Use pkgs.substitute instead of builtins.replaceStrings - Turn off the single-page feature for now. It was added by Valentin in a previous commit, but I think we should discuss this a bit more - Simplify a lot of the code and add comments - Fix the mutable redirects, they were broken by a parent commit - Remove pieces of Nix code that weren't used, like the import of the Nixpkgs manual. This can be added in the future when necessary - Make sure that Nix versions are cached by building from the store path
32 lines
910 B
Nix
32 lines
910 B
Nix
{ writeShellApplication
|
|
, git
|
|
, niv
|
|
, nix
|
|
, ripgrep
|
|
, coreutils
|
|
, jq
|
|
}:
|
|
# add or update Nixpkgs releases using `niv`
|
|
writeShellApplication {
|
|
name = "update-nixpkgs-releases";
|
|
runtimeInputs = [ git niv nix ripgrep jq coreutils ];
|
|
text = ''
|
|
echo >&2 "Updating rolling"
|
|
niv update nixpkgs-rolling
|
|
echo >&2 "Updating stable releases"
|
|
niv -s nix/nixpkgs-versions.json update
|
|
|
|
echo >&2 "Adding any new releases"
|
|
# get release branches
|
|
git ls-remote https://github.com/nixos/nixpkgs "refs/heads/*" \
|
|
| rg '^([0-9a-f]+)\trefs/heads/nixos-(\d\d\.\d\d)$' -or '$2' \
|
|
| sort --reverse --version-sort \
|
|
| while read -r version; do
|
|
|
|
if ! jq -e --arg version "$version" 'has($ARGS.named.version)' nix/nixpkgs-versions.json >/dev/null; then
|
|
niv -s nix/nixpkgs-versions.json add nixos/nixpkgs -n "$version" -b "nixos-$version"
|
|
fi
|
|
done
|
|
'';
|
|
}
|