mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 06:05:59 +01:00
Nix CI: split inputs and wlroots updating
Now there are separate update scripts for wlroots and for all other inputs.
This commit is contained in:
parent
86e487e003
commit
981c71e60a
4 changed files with 85 additions and 21 deletions
40
.github/workflows/nix-update-inputs.yaml
vendored
Normal file
40
.github/workflows/nix-update-inputs.yaml
vendored
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
name: "Nix update"
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update:
|
||||||
|
name: "inputs"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Clone repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install nix
|
||||||
|
uses: cachix/install-nix-action@v20
|
||||||
|
with:
|
||||||
|
install_url: https://nixos.org/nix/install
|
||||||
|
extra_nix_config: |
|
||||||
|
auto-optimise-store = true
|
||||||
|
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
||||||
|
experimental-features = nix-command flakes
|
||||||
|
|
||||||
|
- name: Update lockfile
|
||||||
|
run: nix/update-nixpkgs.sh
|
||||||
|
|
||||||
|
- uses: cachix/cachix-action@v12
|
||||||
|
with:
|
||||||
|
name: hyprland
|
||||||
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||||
|
|
||||||
|
- name: Build packages
|
||||||
|
run: nix flake check --print-build-logs --accept-flake-config
|
||||||
|
|
||||||
|
- name: Build Waybar-Hyprland
|
||||||
|
run: nix build .#waybar-hyprland --print-build-logs
|
||||||
|
|
||||||
|
- uses: stefanzweifel/git-auto-commit-action@v4
|
||||||
|
with:
|
||||||
|
commit_message: "Nix: bump inputs"
|
|
@ -1,13 +1,15 @@
|
||||||
name: "Nix: update lockfile"
|
name: "Nix update"
|
||||||
|
|
||||||
on: [push, workflow_dispatch]
|
on: [push, workflow_dispatch]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update:
|
update:
|
||||||
|
name: "wlroots"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Clone repository
|
- name: Clone repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Install nix
|
- name: Install nix
|
||||||
uses: cachix/install-nix-action@v20
|
uses: cachix/install-nix-action@v20
|
||||||
with:
|
with:
|
||||||
|
@ -16,14 +18,18 @@ jobs:
|
||||||
auto-optimise-store = true
|
auto-optimise-store = true
|
||||||
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
||||||
experimental-features = nix-command flakes
|
experimental-features = nix-command flakes
|
||||||
|
|
||||||
- name: Update lockfile
|
- name: Update lockfile
|
||||||
run: nix/update-inputs.sh
|
run: nix/update-wlroots.sh
|
||||||
|
|
||||||
- uses: cachix/cachix-action@v12
|
- uses: cachix/cachix-action@v12
|
||||||
with:
|
with:
|
||||||
name: hyprland
|
name: hyprland
|
||||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||||
- name: Build Waybar-Hyprland
|
|
||||||
run: nix build .#waybar-hyprland --print-build-logs
|
- name: Build packages
|
||||||
|
run: nix flake check --print-build-logs --accept-flake-config
|
||||||
|
|
||||||
- uses: stefanzweifel/git-auto-commit-action@v4
|
- uses: stefanzweifel/git-auto-commit-action@v4
|
||||||
with:
|
with:
|
||||||
commit_message: "[gha] bump flake inputs"
|
commit_message: "Nix: bump wlroots"
|
|
@ -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
|
# get the current Nixpkgs revision
|
||||||
SUB_REV=$(git submodule status | rg wlroots | awk '{ print substr($1,2)}')
|
REV=$(jq <flake.lock '.nodes.nixpkgs.locked.rev' -r)
|
||||||
# and from lockfile
|
# check versions for current and remote nixpkgs' mesa
|
||||||
CRT_REV=$(jq <flake.lock '.nodes.wlroots.locked.rev' -r)
|
CRT_VER=$(nix eval --raw github:nixos/nixpkgs/"$REV"#mesa.version)
|
||||||
|
NEW_VER=$(nix eval --raw github:nixos/nixpkgs/nixos-unstable#mesa.version)
|
||||||
|
|
||||||
|
if [ "$CRT_VER" != "$NEW_VER" ]; then
|
||||||
|
echo "Updating Mesa $CRT_VER -> $NEW_VER and flake inputs"
|
||||||
|
|
||||||
|
# keep wlroots rev, as we don't want to update it
|
||||||
|
WLR_REV=$(nix flake metadata --json | jq -r '.locks.nodes.wlroots.locked.rev')
|
||||||
|
|
||||||
if [ "$SUB_REV" != "$CRT_REV" ]; then
|
|
||||||
# update inputs to latest versions
|
# update inputs to latest versions
|
||||||
nix flake update
|
nix flake update
|
||||||
|
|
||||||
# update wlroots to submodule revision
|
# hold back wlroots (nix/update-wlroots.nix handles updating that)
|
||||||
nix flake lock --override-input wlroots "gitlab:wlroots/wlroots/$SUB_REV?host=gitlab.freedesktop.org"
|
nix flake lock --override-input wlroots "gitlab:wlroots/wlroots/$WLR_REV?host=gitlab.freedesktop.org"
|
||||||
|
|
||||||
# remove "dirty" mark from lockfile
|
|
||||||
jq <flake.lock 'del(.nodes.wlroots.original.rev)' | sponge flake.lock
|
|
||||||
|
|
||||||
# fix revision in wlroots.wrap
|
|
||||||
sed -Ei "s/[a-z0-9]{40}/$SUB_REV/g" subprojects/wlroots.wrap
|
|
||||||
else
|
else
|
||||||
echo "wlroots is up to date!"
|
echo "nixpkgs is up to date!"
|
||||||
fi
|
fi
|
||||||
|
|
17
nix/update-wlroots.sh
Executable file
17
nix/update-wlroots.sh
Executable file
|
@ -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
|
Loading…
Reference in a new issue