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.
|
Most other services use packages that are already included in nixpkgs.
|
||||||
|
|
||||||
## Switching to a new NixOS release
|
## Switching to a new NixOS release
|
||||||
|
- Run command `update-flake.sh 24.11`
|
||||||
- [flake.nix](../flake.nix): update `nixpkgs.url`
|
|
||||||
- [cirrus.yml](../.cirrus.yml): update toplevel container -> image attribute
|
- [cirrus.yml](../.cirrus.yml): update toplevel container -> image attribute
|
||||||
- [examples/configuration.nix](../examples/configuration.nix): update `system.stateVersion`
|
- [examples/configuration.nix](../examples/configuration.nix): update `system.stateVersion`
|
||||||
- [examples/flakes/flake.nix](../examples/flakes/flake.nix): update `inputs.nix-bitcoin.url`
|
- [examples/flakes/flake.nix](../examples/flakes/flake.nix): update `inputs.nix-bitcoin.url`
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,9 @@
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# This script does the following:
|
# 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:
|
# - Print version updates of pinned pkgs like so:
|
||||||
# Pkg updates in nixpkgs unstable:
|
# Pkg updates in nixpkgs unstable:
|
||||||
# bitcoin: 0.20.0 -> 0.21.1
|
# bitcoin: 0.20.0 -> 0.21.1
|
||||||
|
|
@ -39,9 +41,11 @@ if [[ $forceRun ]] && ! git diff --quiet ../flake.{nix,lock}; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ ! $nixosVersion ]]; then
|
||||||
echo "Updating flake 'nixos-search'"
|
echo "Updating flake 'nixos-search'"
|
||||||
nix flake update --flake ../test/nixos-search
|
nix flake update --flake ../test/nixos-search
|
||||||
echo
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
versions=$(nix eval --json -f update-flake.nix versions)
|
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"
|
echo "Updating main flake"
|
||||||
if [[ $nixosVersion ]]; then
|
if [[ $nixosVersion ]]; then
|
||||||
sed -Ei "s|(nixpkgs.url = .*nixos-)[^\"]+|\1$nixosVersion|" ../flake.nix
|
sed -Ei "s|(nixpkgs.url = .*nixos-)[^\"]+|\1$nixosVersion|" ../flake.nix
|
||||||
fi
|
nix flake update nixpkgs --flake ..
|
||||||
|
else
|
||||||
nix flake update --flake ..
|
nix flake update --flake ..
|
||||||
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
nix eval --raw -f update-flake.nix --argstr prevVersions "$versions" showUpdates; echo
|
nix eval --raw -f update-flake.nix --argstr prevVersions "$versions" showUpdates; echo
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue