Skip to content

Update flake inputs #20

Update flake inputs

Update flake inputs #20

Workflow file for this run

name: Update flake inputs
on:
workflow_dispatch:
schedule:
- cron: "0 1 * * *"
permissions:
contents: write
pull-requests: write
concurrency:
group: update-flake-${{ github.ref }}
cancel-in-progress: false
jobs:
update-flake:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Sync latest branch tip
run: git pull --ff-only origin "${GITHUB_REF_NAME}"
- name: Install Nix
uses: nixbuild/nix-quick-install-action@v34
with:
nix_conf: |
keep-env-derivations = true
keep-outputs = true
experimental-features = nix-command flakes
- name: Restore and save Nix store
uses: nix-community/cache-nix-action@v7
with:
primary-key: nix-${{ hashFiles('**/*.nix', '**/flake.lock') }}
restore-prefixes-first-match: nix-
gc-max-store-size-linux: 1G
purge: true
purge-prefixes: nix-
purge-created: 0
purge-last-accessed: 0
purge-primary-key: never
- name: Update flake inputs
run: nix flake update
- name: Update NixOS flake inputs
working-directory: Linux/NixOS
run: nix flake update
- name: Check public flake
run: nix flake check --no-build
- name: Build public shell module check
run: nix build --no-link --print-build-logs .#checks.x86_64-linux.shells-module
- name: Build public mysetup package
run: nix build .#mysetup --print-build-logs
- name: Smoke-test public mysetup binary
run: ./result/bin/mysetup --help
- name: Build patched end4 Hypr config
working-directory: Linux/NixOS
run: nix build --no-link --print-build-logs '.#nixosConfigurations.NixOS.config.home-manager.users.user.xdg.configFile."hypr/end4".source'
- name: Build patched Caelestia shell
working-directory: Linux/NixOS
run: nix build --no-link --print-build-logs '.#nixosConfigurations.NixOS.config.home-manager.users.user.programs.caelestia.package'
- name: Build NixOS mysetup package
working-directory: Linux/NixOS
run: nix build .#mysetup --print-build-logs
- name: Smoke-test NixOS mysetup binary
working-directory: Linux/NixOS
run: ./result/bin/mysetup --help
- name: Check for changes
id: check
working-directory: ${{ github.workspace }}
run: |
if git diff --exit-code flake.lock Linux/NixOS/flake.lock > /dev/null; then
echo "modified=false" >> "$GITHUB_OUTPUT"
else
echo "modified=true" >> "$GITHUB_OUTPUT"
fi
- name: Create pull request
id: cpr
if: steps.check.outputs.modified == 'true'
uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore(nix): update flake locks"
branch: "update-flake-locks"
delete-branch: true
add-paths: |
flake.lock
Linux/NixOS/flake.lock
title: "chore(nix): update flake locks"
body: |
## What
Updates root and NixOS flake locks after scheduled input refresh.
## Why
Keeps pinned flake inputs current while preserving review through a pull request.
## Testing
- `nix flake check --no-build`
- `nix build --no-link --print-build-logs .#checks.x86_64-linux.shells-module`
- `nix build .#mysetup --print-build-logs`
- `./result/bin/mysetup --help`
- `nix build --no-link --print-build-logs '.#nixosConfigurations.NixOS.config.home-manager.users.user.xdg.configFile."hypr/end4".source'`
- `nix build --no-link --print-build-logs '.#nixosConfigurations.NixOS.config.home-manager.users.user.programs.caelestia.package'`
- `nix build .#mysetup --print-build-logs`
- `./result/bin/mysetup --help`
- name: Merge pull request
if: steps.cpr.outputs.pull-request-number != ''
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ steps.cpr.outputs.pull-request-number }}
run: |
if gh pr merge "$PR_NUMBER" --squash --delete-branch; then
exit 0
fi
gh pr merge "$PR_NUMBER" --auto --squash --delete-branch