2023-07-04 22:21:24 +02:00
|
|
|
#!/usr/bin/env -S nix shell nixpkgs#jq -c bash
|
2022-12-24 01:20:02 +01:00
|
|
|
|
2023-07-04 22:21:24 +02:00
|
|
|
# Update inputs when the Mesa version is outdated. We don't want
|
|
|
|
# incompatibilities between the user's system and Hyprland.
|
2022-06-01 00:52:34 +02:00
|
|
|
|
2023-07-04 22:21:24 +02:00
|
|
|
# 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)
|
2022-06-01 23:08:03 +02:00
|
|
|
|
2023-07-04 22:21:24 +02:00
|
|
|
if [ "$CRT_VER" != "$NEW_VER" ]; then
|
|
|
|
echo "Updating Mesa $CRT_VER -> $NEW_VER and flake inputs"
|
2022-06-01 23:42:05 +02:00
|
|
|
|
2023-07-04 22:21:24 +02:00
|
|
|
# keep wlroots rev, as we don't want to update it
|
|
|
|
WLR_REV=$(nix flake metadata --json | jq -r '.locks.nodes.wlroots.locked.rev')
|
2022-06-01 00:52:34 +02:00
|
|
|
|
2023-07-04 22:21:24 +02:00
|
|
|
# update inputs to latest versions
|
|
|
|
nix flake update
|
2023-05-16 19:50:18 +02:00
|
|
|
|
2023-07-04 22:21:24 +02:00
|
|
|
# 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"
|
2022-06-01 23:08:03 +02:00
|
|
|
else
|
2023-07-04 22:21:24 +02:00
|
|
|
echo "nixpkgs is up to date!"
|
2022-06-01 23:08:03 +02:00
|
|
|
fi
|