-
Notifications
You must be signed in to change notification settings - Fork 241
[Nix] Update flake.lock (59 weeks behind) + Fix CI for Nix #533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Nix] Update flake.lock (59 weeks behind) + Fix CI for Nix #533
Conversation
| name: Check Nix flake | ||
| on: | ||
| pull_request_target: | ||
| pull_request: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of this change is to fix the automated Nix CI workflow for the nix flake check command.
The Problem
The old workflow used pull_request_target, which caused it to run checks against the outdated flake.lock file from the main branch, leading to consistent failures due to the constraints of this workflow (which requires the tested branch to have a flake.lock file generated in the last 30 days).
See image source here
The Solution
This change switches the workflow to the pull_request trigger, which correctly runs checks against the flake.lock being added in a pull request branch rather than against the flake.lock in the main branch.
Why It's Still Failing
Because the workflow specifications are read from the main branch, the new pull_request trigger will not take effect until this change is merged. The checks will continue to fail until then, and as a result you will likely have to override the checks to deploy this.
| pull_request: | ||
| paths: | ||
| - '*.nix' | ||
| - '**.nix' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of this change is to ensure that this CI check is triggered in all cases it is required, i.e. whenever any changes are made to any files in the project that have a .nix file extension.
The Problem
'*.nix' only grabs Nix files in the project root directory, e.g. flake.nix. This means this check won't get triggered if a PR has changes applied to .nix files elsewhere in the project, such as in the nix directory. This effectively means files outside of the root directory like nix/shell-plugins.nix can be changed without this workflow being triggered.
The Solution
'**.nix' is the format recommended by GitHub's docs; it should ensure that this GitHub workflow will trigger on changes to any Nix files in any directories in the project, avoiding situations where checks should have been run but were not.
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| FILE_TO_COMMIT: flake.lock | ||
| COMMIT_BRANCH: automation/update-flake-dependencies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of this change is to fix the broken weekly Update flake dependencies GitHub workflow.
The Problem
Once a week and on manual workflow executions, the same branch name automation/update-flake-dependencies is being created even though it is never being updated or cleaned up, which causes it to fail on on each subsequent run of this GitHub Action.

See full error log from screenshot here.
The Solution
Add a timestamp to the end of the branch name so it is unique. This means that a new branch + PR will be created on every run of this workflow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: the reason I made a separate branch was under the assumption that if a new branch and PR is created every week, it will notify the 2nd reviewer more frequently and may result in more of the PRs getting the 2nd approvals they need, but obviously it's more of a spammy solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally I would not have updated the lock file in the same PR as CI changes, but your entire CI pipeline for Nix is not working as expected and that is partially because it is dependent on an up-to-date flake.lock file generated within the last 30 days in order to pass checks. See The Problem in this comment for more details.
|
Hi @mrjones2014, I noticed you're a key maintainer for the Nix tooling on this project, and I'm a big fan of the work you've done. I saw that the Nix-related GitHub Actions workflows have been failing recently and that the I've left detailed comments to explain the fixes. Please note that the CI checks on this PR are currently failing because the existing broken workflow from the main branch is being used. My proposed changes won't be active until this PR is merged (the comments go more into depth on this). If you have the bandwidth, I'd be happy to submit a few more small fixes to help get the project's Nix tooling back on track. Thanks for your work making |
|
Hi, thanks for your contribution! I've previously attempted to solve part of this problem by making it update the existing PR if one exists. I've also attempted to reduce the approval burden by automating one of two required approvals. Unfortunately, this stuff has just not merged because the repo policy requires two approvals, including one from a user with write access to the repo (which I don't have). As I've also been unable to get any of the Nix related PRs merged, I've unfortunately resorted to just vendoring the Nix 1Password Shell Plugins functionality into my own dotfiles. |
|
I really think fixing the approval burden would help enormously -- I almost mentioned in my last comment it seemed like that was the big blocker from what I've seen. I wish I could approve that 1-liner for the 1Password-bot to help you out, but obviously as someone from outside of your organization I understand that probably isn't possible. Thanks for sharing your vendoring solution -- I will do something similar for the time being! Let me know if there's anything else you think I can do to contribute. |
|
Hi @RyanPrussin thanks for your contributions! We've kickstarted Nix maintenance again internally, partly thanks to your PR! This PR has been superseded now by the combination of:
Closing this one as the issues are now resolved by the above PRs, thanks again! |
|
Glad to hear it, @mrjones2014 ! I did just want to mention that you should probably still make these changes:
|
|
Gotcha, if you submit a PR with those changes I'm happy to review! |
Overview
A bunch of Nix CI commands are failing, and as a result the process you guys have to automate updating the
flake.lockfile has failed for 59 weeks straight and therefore the version of Nix being used is over a year behind.I did the following:
nix flake updatemanually to update theflake.lockfileType of change
How To Test
nix flake check --all-systemsChangelog
Update
flake.lockto most recent version of nixpkgs and fix GitHub CI workflows related to Nix.