Skip to content

Conversation

@l0b0
Copy link

@l0b0 l0b0 commented Nov 26, 2025

Description

The more complex a flake, the less likely that nix flake update will Just Work™. This adds a module to do the grunt work automatically for any number of repos with a flake.nix and flake.lock on a schedule:

  1. Make sure that flake.nix is in a clean state in the Git repository,
    otherwise skip the directory.
  2. Make sure nothing is staged in the Git repository, otherwise skip the
    directory.
  3. Update a single input at a time. For each input:
    1. If the input is already up to date, skip the rest of the steps.
    2. Make sure all the NixOS configurations and dev shells still build
      after each update (optionally with extra commands).
    3. Commit flake.lock (and only flake.lock) if all the build and extra
      commands pass.
    4. Revert flake.lock if any of the above fails.
  4. Report errors about inputs which can't be updated after processing each
    directory.

Checklist

  • Change is backwards compatible.

  • Code formatted with nix fmt or
    nix-shell -p treefmt nixfmt deadnix keep-sorted --run treefmt.

  • Code tested through nix run .#tests -- test-all or
    nix-shell --pure tests -A run.all.

  • Test cases updated/added. See example.

  • Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • Added myself as module maintainer. See example.
    • Generate a news entry. See News
    • Basic tests added. See Tests
  • If this PR adds an exciting new feature or contains a breaking change.

    • Generate a news entry. See News

@l0b0 l0b0 force-pushed the auto-update-flake-inputs branch from 8f909cd to e85279b Compare November 26, 2025 18:40
@l0b0 l0b0 force-pushed the auto-update-flake-inputs branch 4 times, most recently from 86f6fd5 to 8bd1504 Compare November 26, 2025 20:27
@l0b0 l0b0 changed the title auto-update-flake-inputs: init update-flake-inputs: init Nov 26, 2025
@l0b0 l0b0 force-pushed the auto-update-flake-inputs branch 4 times, most recently from dd01ce6 to 2f70198 Compare November 27, 2025 19:14
l0b0 added 2 commits November 29, 2025 00:26
A user service which will run `nix flake update` on every flake input in
the specified directories.
@l0b0 l0b0 force-pushed the auto-update-flake-inputs branch from 2f70198 to 36dad8c Compare November 28, 2025 23:26
@l0b0
Copy link
Author

l0b0 commented Nov 28, 2025

This is ending up being rather user-specific. I'll re-open if I can figure out a non-horrible way to make this more generic.

@l0b0 l0b0 closed this Nov 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant