update-flake.sh: add workflow for updating the NixOS version
This commit is contained in:
parent
f60a50607d
commit
ba46d20a25
2 changed files with 12 additions and 7 deletions
|
|
@ -97,8 +97,7 @@ It's easiest to use an existing service as a template:
|
|||
Most other services use packages that are already included in nixpkgs.
|
||||
|
||||
## Switching to a new NixOS release
|
||||
|
||||
- [flake.nix](../flake.nix): update `nixpkgs.url`
|
||||
- Run command `update-flake.sh 24.11`
|
||||
- [cirrus.yml](../.cirrus.yml): update toplevel container -> image attribute
|
||||
- [examples/configuration.nix](../examples/configuration.nix): update `system.stateVersion`
|
||||
- [examples/flakes/flake.nix](../examples/flakes/flake.nix): update `inputs.nix-bitcoin.url`
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
set -euo pipefail
|
||||
|
||||
# This script does the following:
|
||||
# - Update all flake inputs, including nixpkgs
|
||||
# - When called without arguments, update all flake inputs, including nixpkgs.
|
||||
# - When called with a version argument, set input `nixpkgs` in `flake.nix` to the
|
||||
# specified version and only update this input.
|
||||
# - Print version updates of pinned pkgs like so:
|
||||
# Pkg updates in nixpkgs unstable:
|
||||
# bitcoin: 0.20.0 -> 0.21.1
|
||||
|
|
@ -39,9 +41,11 @@ if [[ $forceRun ]] && ! git diff --quiet ../flake.{nix,lock}; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! $nixosVersion ]]; then
|
||||
echo "Updating flake 'nixos-search'"
|
||||
nix flake update --flake ../test/nixos-search
|
||||
echo
|
||||
fi
|
||||
|
||||
versions=$(nix eval --json -f update-flake.nix versions)
|
||||
|
||||
|
|
@ -51,8 +55,10 @@ versions=$(nix eval --json -f update-flake.nix versions)
|
|||
echo "Updating main flake"
|
||||
if [[ $nixosVersion ]]; then
|
||||
sed -Ei "s|(nixpkgs.url = .*nixos-)[^\"]+|\1$nixosVersion|" ../flake.nix
|
||||
fi
|
||||
nix flake update nixpkgs --flake ..
|
||||
else
|
||||
nix flake update --flake ..
|
||||
fi
|
||||
|
||||
echo
|
||||
nix eval --raw -f update-flake.nix --argstr prevVersions "$versions" showUpdates; echo
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue