2022-12-24 03:20:02 +03:00
|
|
|
#!/usr/bin/env -S nix shell nixpkgs#gawk nixpkgs#git nixpkgs#moreutils nixpkgs#jq nixpkgs#ripgrep -c bash
|
|
|
|
|
|
|
|
set -ex
|
2022-06-01 01:52:34 +03:00
|
|
|
|
2022-06-02 00:08:03 +03:00
|
|
|
# get wlroots revision from submodule
|
2022-12-24 03:20:02 +03:00
|
|
|
SUB_REV=$(git submodule status | rg wlroots | awk '{ print substr($1,2)}')
|
2022-06-02 00:08:03 +03:00
|
|
|
# and from lockfile
|
|
|
|
CRT_REV=$(jq < flake.lock '.nodes.wlroots.locked.rev' -r)
|
|
|
|
|
|
|
|
if [ $SUB_REV != $CRT_REV ]; then
|
2022-06-02 00:42:05 +03:00
|
|
|
# update nixpkgs to latest version
|
|
|
|
nix flake lock --update-input nixpkgs
|
|
|
|
|
2022-06-02 00:08:03 +03:00
|
|
|
# update wlroots to submodule revision
|
2022-06-22 23:23:46 +03:00
|
|
|
nix flake lock --override-input wlroots "gitlab:wlroots/wlroots/$SUB_REV?host=gitlab.freedesktop.org"
|
2022-06-01 01:52:34 +03:00
|
|
|
|
2022-06-02 00:08:03 +03:00
|
|
|
# remove "dirty" mark from lockfile
|
|
|
|
jq < flake.lock 'del(.nodes.wlroots.original.rev)' | sponge flake.lock
|
|
|
|
else
|
|
|
|
echo "wlroots is up to date!"
|
|
|
|
fi
|