-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
Development shell with a pinned nixfmt #322512
Conversation
9ca305f
to
65bc415
Compare
db1efeb
to
8f2e12e
Compare
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/formatting-team-meeting-2024-06-25/47661/1 |
This comment was marked as outdated.
This comment was marked as outdated.
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.
Cool!
A few nits and it's good for me.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This creates a new directory for all CI support files, will be populated in future commits.
This is needed such that in the next commit, we can re-use the same version from a shell.nix, allowing people to have a guaranteed matching nixfmt version.
This uses the reusable pinned Nixpkgs from the parent commit to create a shell.nix file for an environment with a pinned nixfmt version.
When some files are not formatted properly, this shows how people can fix the problem. This notably uses the shell.nix introduced in the parent commit to ensure that the nixfmt version matches what CI expects.
0d74a6b
to
58f98e4
Compare
Since I don't want this PR to focus on the direnv part, I split that into a separate PR that depends on this one: #322650 (also moved all comments about it there) |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/tweag-nix-dev-update-57/47823/1 |
# https://stackoverflow.com/a/246128 | ||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
repo=https://github.com/nixos/nixpkgs |
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.
-repo=https://github.com/nixos/nixpkgs
+repo=https://github.com/NixOS/nixpkgs
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.
GitHub also works with the lowercase version, so I don't think this matters nor worth changing, even if only to set a precedent for less bikeshedding :P
Since this has been approved by 3 other members of the formatting team, let's go ahead with merging this ;) |
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin release-24.05
git worktree add -d .worktree/backport-322512-to-release-24.05 origin/release-24.05
cd .worktree/backport-322512-to-release-24.05
git switch --create backport-322512-to-release-24.05
git cherry-pick -x 13599930cb314ca9335fbb9dcb31acc4342f748d b33ac05d043c03cf98397e5f026ee5a93b781199 a70ab58960c254c58c5289b18b769c9d2311dce7 53b517c6851ef52a86e44ea16220d93f88bf9849 d0bebb7d6b86a705f943dc926527400d7ebc144b 58f98e4b1bc487a519b0f57e9723eb2ce223c229 |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/more-official-guidelines-in-regards-to-styling-choices/48407/1 |
Manual backport of this is in #326630 |
It's a shame this has broken |
@alyssais Oh damn, yeah that's something that didn't occur to me in advance. Looks like |
Learning to add a . isn't too bad, so I think it would only be worth doing something if it didn't break people's workflows at all, but it's still a shame it broke. |
Does it? It doesn't seem to for me (CppNix 2.24.9). |
Yeah, it got even worse with Nix 2.24: NixOS/nix#11699 |
nix#11699 does fix five reported issues, so it would be unfortunate to regress those now. For these reasons I think it is preferable to fix it completely on the Nixpkgs side |
Description of changes
This is a decently-sized step towards having a fully nixfmt-formatted Nixpkgs (#322520) 🎉. I'd like others in the @NixOS/nix-formatting to approve this.
This PR makes it such that the existing workflow to check Nix formatting gives clear instructions on how to fix unformatted files.
It does so by introducing a
shell.nix
file for Nixpkgs that provides users with a pinnednixfmt
version that matches CI.Along with it comes a workflow to check that
nix-build shell.nix
works onx86_64-linux
andaarch64-darwin
(the two relevant platforms available in GitHub Actions), such that it doesn't break randomlyThis PR introduces 2 new entries in the root of the directory tree (
shell.nix
andci
for some extra CI bits), exciting!Things done
nix-shell
andnixfmt pkgs/development/cuda-modules
in it, a directory that's already enforced to be formattedThis work is sponsored by Antithesis ✨
Add a 👍 reaction to pull requests you find important.