dev: add more automation to NixOS version updates

Use the `update-flake.sh` script to auto-update the NixOS version at
various places.

Also update `examples/container/flake.nix` which has been
missing in the update instructions.
This commit is contained in:
Erik Arvstedt 2025-01-22 20:45:52 +01:00
parent dc4d14e073
commit fe8c6b1e6a
No known key found for this signature in database
GPG key ID: 33312B944DD97846
3 changed files with 11 additions and 5 deletions

View file

@ -52,9 +52,18 @@ versions=$(nix eval --json -f update-flake.nix versions)
## Uncomment the following to generate a version change message for testing
# versions=$(echo "$versions" | sed 's|1|0|g')
setVersion() {
sed -Ei "s|($1)[0-9.]+|\1$nixosVersion|" "$2"
}
echo "Updating main flake"
if [[ $nixosVersion ]]; then
sed -Ei "s|(nixpkgs.url = .*nixos-)[^\"]+|\1$nixosVersion|" ../flake.nix
setVersion 'nixpkgs.url = .*?nixos-' ../flake.nix
setVersion 'system.stateVersion = "' ../examples/configuration.nix
setVersion 'nix-bitcoin.url = .*?/nixos-' ../examples/flakes/flake.nix
setVersion 'nix-bitcoin.url = .*?/nixos-' ../examples/container/flake.nix
setVersion 'image: nixpkgs.*?nixos-' ../.cirrus.yml
setVersion 'update-flake.sh ' ../dev/README.md
nix flake update nixpkgs --flake ..
else
nix flake update --flake ..