Update NixOS #97
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Update NixOS" | |
on: | |
workflow_dispatch: # allows manual triggering | |
schedule: | |
- cron: "27 0 * * 3" | |
jobs: | |
update-nix: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Free disk space | |
run: .github/free_disk_space.sh | |
- name: Install Nix | |
uses: DeterminateSystems/nix-installer-action@main | |
- name: Install Cachix | |
uses: cachix/cachix-action@v15 | |
with: | |
name: jl-nix | |
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" | |
- name: Build old NixOS | |
run: | | |
nix build -o /tmp/old_system .#nixosConfigurations.beta.config.system.build.toplevel | |
- name: Build old home-manager | |
run: | | |
nix build -o /tmp/old_hm .#homeConfigurations.jlle@beta.activationPackage | |
- name: Update flake.nix | |
run: | | |
nix flake update | |
- name: Build new NixOS | |
run: | | |
nix build -o /tmp/new_system .#nixosConfigurations.beta.config.system.build.toplevel | |
- name: Build new home-manager | |
run: | | |
nix build -o /tmp/new_hm .#homeConfigurations.jlle@beta.activationPackage | |
- name: Get NixOS diff | |
id: get-pr-body | |
run: | | |
nix run github:NixOS/nixpkgs/nixos-unstable#nvd -- --color never diff /tmp/old_system /tmp/new_system > /tmp/pr-body.txt | |
body=$(cat /tmp/pr-body.txt) | |
echo 'body<<EOF' >> $GITHUB_OUTPUT | |
echo "$body" >> $GITHUB_OUTPUT | |
echo 'EOF' >> $GITHUB_OUTPUT | |
- name: Get home-manager diff | |
id: get-pr-hm | |
run: | | |
nix run github:NixOS/nixpkgs/nixos-unstable#nvd -- --color never diff /tmp/old_hm /tmp/new_hm > /tmp/pr-hm.txt | |
body=$(cat /tmp/pr-hm.txt) | |
body="${body//'%'/'%25'}" | |
body="${body//$'\r'/'%0D'}" | |
echo 'body<<EOF' >> $GITHUB_OUTPUT | |
echo "$body" >> $GITHUB_OUTPUT | |
echo 'EOF' >> $GITHUB_OUTPUT | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v6.0.5 | |
with: | |
body: | | |
# NixOS changes: | |
```bash | |
${{ steps.get-pr-body.outputs.body }} | |
``` | |
# Home Manager changes: | |
```bash | |
${{ steps.get-pr-hm.outputs.body }} | |
``` | |
commit-message: Update flake lock | |
title: Update flake.nix | |
assignees: jlesquembre | |
branch: update-flake-nix |