diff options
author | Mihai Fufezan <[email protected]> | 2023-07-04 23:21:24 +0300 |
---|---|---|
committer | Mihai Fufezan <[email protected]> | 2023-07-05 16:46:02 +0300 |
commit | 981c71e60a4db9838e82dd721f0e5ae4981529aa (patch) | |
tree | e2a73daaeed25118d394b322ae74a5f9c8a64307 /nix | |
parent | 86e487e003490195f88b8deaf2b1f4baa75b0058 (diff) | |
download | Hyprland-981c71e60a4db9838e82dd721f0e5ae4981529aa.tar.gz Hyprland-981c71e60a4db9838e82dd721f0e5ae4981529aa.zip |
Nix CI: split inputs and wlroots updating
Now there are separate update scripts for wlroots and for all other
inputs.
Diffstat (limited to 'nix')
-rwxr-xr-x | nix/update-inputs.sh | 33 | ||||
-rwxr-xr-x | nix/update-wlroots.sh | 17 |
2 files changed, 34 insertions, 16 deletions
diff --git a/nix/update-inputs.sh b/nix/update-inputs.sh index b5aeff2e..96be06b5 100755 --- a/nix/update-inputs.sh +++ b/nix/update-inputs.sh @@ -1,24 +1,25 @@ -#!/usr/bin/env -S nix shell nixpkgs#gawk nixpkgs#git nixpkgs#gnused nixpkgs#moreutils nixpkgs#jq nixpkgs#ripgrep -c bash +#!/usr/bin/env -S nix shell nixpkgs#jq -c bash -set -ex +# Update inputs when the Mesa version is outdated. We don't want +# incompatibilities between the user's system and Hyprland. -# get wlroots revision from submodule -SUB_REV=$(git submodule status | rg wlroots | awk '{ print substr($1,2)}') -# and from lockfile -CRT_REV=$(jq <flake.lock '.nodes.wlroots.locked.rev' -r) +# get the current Nixpkgs revision +REV=$(jq <flake.lock '.nodes.nixpkgs.locked.rev' -r) +# check versions for current and remote nixpkgs' mesa +CRT_VER=$(nix eval --raw github:nixos/nixpkgs/"$REV"#mesa.version) +NEW_VER=$(nix eval --raw github:nixos/nixpkgs/nixos-unstable#mesa.version) -if [ "$SUB_REV" != "$CRT_REV" ]; then - # update inputs to latest versions - nix flake update +if [ "$CRT_VER" != "$NEW_VER" ]; then + echo "Updating Mesa $CRT_VER -> $NEW_VER and flake inputs" - # update wlroots to submodule revision - nix flake lock --override-input wlroots "gitlab:wlroots/wlroots/$SUB_REV?host=gitlab.freedesktop.org" + # keep wlroots rev, as we don't want to update it + WLR_REV=$(nix flake metadata --json | jq -r '.locks.nodes.wlroots.locked.rev') - # remove "dirty" mark from lockfile - jq <flake.lock 'del(.nodes.wlroots.original.rev)' | sponge flake.lock + # update inputs to latest versions + nix flake update - # fix revision in wlroots.wrap - sed -Ei "s/[a-z0-9]{40}/$SUB_REV/g" subprojects/wlroots.wrap + # hold back wlroots (nix/update-wlroots.nix handles updating that) + nix flake lock --override-input wlroots "gitlab:wlroots/wlroots/$WLR_REV?host=gitlab.freedesktop.org" else - echo "wlroots is up to date!" + echo "nixpkgs is up to date!" fi diff --git a/nix/update-wlroots.sh b/nix/update-wlroots.sh new file mode 100755 index 00000000..858b17e6 --- /dev/null +++ b/nix/update-wlroots.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env -S nix shell nixpkgs#gawk nixpkgs#git nixpkgs#gnused nixpkgs#jq nixpkgs#ripgrep -c bash + +# get wlroots revision from submodule +SUB_REV=$(git submodule status | rg wlroots | awk '{ print substr($1,2)}') +# and from lockfile +CRT_REV=$(jq <flake.lock '.nodes.wlroots.locked.rev' -r) + +if [ "$SUB_REV" != "$CRT_REV" ]; then + echo "Updating wlroots..." + # update wlroots to submodule revision + nix flake lock --override-input wlroots "gitlab:wlroots/wlroots/$SUB_REV?host=gitlab.freedesktop.org" + + # fix revision in wlroots.wrap + sed -Ei "s/[a-z0-9]{40}/$SUB_REV/g" subprojects/wlroots.wrap +else + echo "wlroots is up to date!" +fi |