Skip to content

Update NixOS

Update NixOS #53

Workflow file for this run

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@v3
- 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@v12
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 .#[email protected]
- 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 .#[email protected]
- 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/[email protected]
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