aboutsummaryrefslogtreecommitdiffhomepage
path: root/nix/update-inputs.sh
blob: 91a835c23953b88474b9f32f8b5d5e949c414005 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env -S nix shell nixpkgs#gawk nixpkgs#git nixpkgs#moreutils nixpkgs#jq nixpkgs#ripgrep -c bash

set -ex

# 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
  # update nixpkgs to latest version
  nix flake lock --update-input nixpkgs

  # update wlroots to submodule revision
  nix flake lock --override-input wlroots "gitlab:wlroots/wlroots/$SUB_REV?host=gitlab.freedesktop.org"

  # remove "dirty" mark from lockfile
  jq < flake.lock 'del(.nodes.wlroots.original.rev)' | sponge flake.lock
else
  echo "wlroots is up to date!"
fi