flake: partition dev dependencies

This removes the need for end-users to manually set
`nixvim.inputs.devshell.follows = ""` (etc)

We offload evaluation of some of our flake modules into a `dev`
partition submodule.
- When its not needed, this submodule is not evaluated.
- When it is needed, it fetches extra inputs from `flake/dev/flake.nix`
  as part of evaluating the submodule.

See https://flake.parts/options/flake-parts-partitions.html
This commit is contained in:
Matt Sturgeon 2025-02-22 16:02:13 +00:00
parent 0ab9947137
commit 6d10fc0c87
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
16 changed files with 366 additions and 285 deletions

View file

@ -6,10 +6,14 @@ on:
# Allow manual triggering
workflow_dispatch:
inputs:
lock:
root_lock:
type: boolean
default: true
description: Update flake.lock
description: Update root flake.lock
dev_lock:
type: boolean
default: true
description: Update dev flake.lock
generate:
type: boolean
default: true
@ -100,9 +104,9 @@ jobs:
git fetch origin "$pr_branch"
git branch --set-upstream-to "origin/$pr_branch"
- name: Update flake.lock
id: flake_lock
if: inputs.lock || github.event_name == 'schedule'
- name: Update root flake.lock
id: root_flake_lock
if: inputs.root_lock || github.event_name == 'schedule'
run: |
old=$(git show --no-patch --format=%h)
nix flake update --commit-lock-file
@ -113,6 +117,22 @@ jobs:
echo "EOF" >> "$GITHUB_OUTPUT"
fi
- name: Update dev flake.lock
id: dev_flake_lock
if: inputs.dev_lock || github.event_name == 'schedule'
run: |
root_nixpkgs=$(nix eval -f . 'inputs.nixpkgs.rev')
old=$(git show --no-patch --format=%h)
nix flake update --commit-lock-file \
--override-input nixpkgs "github:NixOS/nixpkgs/$root_nixpkgs" \
--flake './flake/dev'
new=$(git show --no-patch --format=%h)
if [ "$old" != "$new" ]; then
echo "body<<EOF" >> "$GITHUB_OUTPUT"
git show --no-patch --format=%b >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
fi
- name: Update generated files
id: generate
if: inputs.generate || github.event_name == 'schedule'
@ -185,9 +205,14 @@ jobs:
title: |
[${{ github.ref_name }}] Update flake.lock & generated files
body: |
## Flake lockfile
## Root lockfile
```
${{ steps.flake_lock.outputs.body || 'No changes' }}
${{ steps.root_flake_lock.outputs.body || 'No changes' }}
```
## Dev lockfile
```
${{ steps.dev_flake_lock.outputs.body || 'No changes' }}
```
## Generate