Skip to content
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

zfs: rename zfsStable -> zfs_2_2; zfsUnstable -> zfs_unstable; remove enableUnstable option in favor of package #291951

Merged
merged 7 commits into from
Mar 1, 2024

Conversation

amarshall
Copy link
Member

Description of changes

Please see individual commit messages for more details (also suggest reviewing per-commit, as the commits are reasonably atomic). Putting as one PR since most of the changes either build on each other semantically or would conflict, but can split up if some parts warrant more discussion.

Overall the goal here is to improve consistency in the naming and handling of different ZFS versions.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

The `zfs` alias already has equivalent semantics. Instead, make this
like zfs_2_1 so folks who want to pin a specific release series can do
so easily and clearly to have more control over when more substantial
updates occur.

Rename all tests to match the pkg attr they are testing.
The previous names are already this.
This matches the naming of other zfs_* pkgs.
`zfs.enableUnstable` only has an effect if `zfs.enabled = true`, so only
require `zfs.enabled` to be true here.
This just adds complexity and confusion. Once-upon-a-time, there was no
`package` and only `enableUnstable`, but now it is just confusing to
have both, as it would be possible to do e.g. `package = pkgs.zfs` and
`enableUnstable = true`, but then `enableUnstable` does nothing.
@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Feb 28, 2024
Copy link
Member

@RaitoBezarius RaitoBezarius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for that!

@ofborg ofborg bot added 8.has: clean-up 8.has: package (new) This PR adds a new package 11.by: package-maintainer This PR was created by the maintainer of the package it changes 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 11-100 labels Feb 28, 2024
@delroth delroth added the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Feb 28, 2024
@RaitoBezarius
Copy link
Member

cc @infinisil on renames which appears as "new top-level" package, how should we proceed about that?

@delroth delroth added 12.approvals: 2 This PR was reviewed and approved by two reputable people 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in the package and removed 12.approvals: 1 This PR was reviewed and approved by one reputable person labels Feb 28, 2024
@AndersonTorres
Copy link
Member

AndersonTorres commented Feb 28, 2024

It triggered by-name again!

Usually it forces the by-name migration.

@amarshall amarshall removed the 8.has: package (new) This PR adds a new package label Feb 28, 2024
@adamcstephens
Copy link
Contributor

I suspect we're going to need to migrate zfs by hand, so maybe we can just ignore the check and merge? Happy to wait and see what infinisil says.

Comment on lines 28729 to 28738
zfs_2_1 = callPackage ../os-specific/linux/zfs/2_1.nix {
configFile = "user";
};
zfsStable = callPackage ../os-specific/linux/zfs/stable.nix {
zfs_2_2 = callPackage ../os-specific/linux/zfs/2_2.nix {
configFile = "user";
};
zfsUnstable = callPackage ../os-specific/linux/zfs/unstable.nix {
zfs_unstable = callPackage ../os-specific/linux/zfs/unstable.nix {
configFile = "user";
};
zfs = zfsStable;
zfs = zfs_2_2;
Copy link
Member

@infinisil infinisil Feb 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the one annoying unanticipated edge case with RFC 140. I do like how it encourages refactorings though: In this case a pkgs.zfsVersions like described in #287918 (comment) would work great, I'd love to see that, it's my recommendation here.

However, merging this PR as is indeed won't break master (I have a PR to make this clearer), but we really shouldn't normalise merging with red checks (that's how we ended up with #289649).

Instead I'd like to improve the error messages and documentation to show how such refactorings can be done (and manually responding to pings as here until then).

Edit: Now opened #292214 to document this better


As a last resort, it's also possible to weaken the check for new packages to not trigger in such cases. This will be easy to do once the code for the automated migration is in place (working on it). I hope this won't be necessary with the improved error message/docs though.

Copy link
Member Author

@amarshall amarshall Feb 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case a pkgs.zfsVersions

This is the opposite of what is described in [pkgs/README.md](https://github.com/NixOS/nixpkgs/blob/c6caed479a521fd96b847d287c3fbdc611ffdca3/pkgs/README.md#package-naming, that suggests multiple versions should be top-level (the example in the doc being json-c_0_9, never suggesting package sets. Package sets also have downsides: they are more awkward to overlay and adding aliases requires foregoing all the tooling builtin to aliases.nix and manually dealing with allowAliases.

we really shouldn't normalise merging with red checks

Agreed, and I appreciate the pause given here (and in another recent PR of mine that renamed—fortunately it was amenable to migration and so it was done (and in general I like pkgs/by-name).

One alternative to consider (nowhere near an opinion) is changing pkgs/by-name migration check to add a comment to the PR when merging is still “okay but discouraged”, rather than a failing check.

Copy link
Member

@infinisil infinisil Feb 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Package sets also have downsides: they are more awkward to overlay and adding aliases requires foregoing all the tooling builtin to aliases.nix and manually dealing with allowAliases.

Oh yeah that's a good point. I just opened #292214 to have a better recommendation that can be applied more generally. Shouldn't be a problem with that.

One alternative that to consider (nowhere near an opinion) is changing pkgs/by-name migration check to add a comment to the PR when merging is still “okay but discouraged”, rather than a failing check.

That's a good idea, I'll keep it in mind and might use it if this becomes a bigger problem. For now I'm hoping the PR I just opened will give a good path forward, and once merged I intend to change the CI check to link to that documentation.

@amarshall
Copy link
Member Author

I’ve followed the suggestion from @infinisil’s PR here, and have pushed as an additional commit on top. PR is now passing the pkgs/by-name check.

@delroth delroth removed the 12.approvals: 2 This PR was reviewed and approved by two reputable people label Mar 1, 2024
@ofborg ofborg bot added the 8.has: package (new) This PR adds a new package label Mar 1, 2024
@ofborg ofborg bot requested a review from adamcstephens March 1, 2024 13:54
@amarshall amarshall removed the 8.has: package (new) This PR adds a new package label Mar 1, 2024
@adamcstephens
Copy link
Contributor

@ofborg build zfs_2_2 zfs_2_2.passthru.tests zfs_unstable zfs_unstable.passthru.tests

@adamcstephens adamcstephens merged commit b52452f into NixOS:master Mar 1, 2024
23 of 25 checks passed
Copy link
Contributor

github-actions bot commented Mar 1, 2024

Backport failed for release-23.11, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin release-23.11
git worktree add -d .worktree/backport-291951-to-release-23.11 origin/release-23.11
cd .worktree/backport-291951-to-release-23.11
git switch --create backport-291951-to-release-23.11
git cherry-pick -x dcff4f831836e249db5e808aeac6ca71d498cdc7 1c846675398059067b6ad147abc6a7877c4b8368 ce5b1e007e1eb96e5df296e33ed884b70dc19250 929fcf93358a833003435c0f74b9bd993f9546d0 2e36c49949f90f14a2ffcc002c8f411b725022d2 1f32eb724ddc9e27573266756c390a6bdcca4439 29a1b11f916e5994f7ad23039ae21945df99247c

@adamcstephens
Copy link
Contributor

Do we really want to backport this?

@RaitoBezarius
Copy link
Member

Unclear to me, but divergence between master and 23.11 will cause issues for further bumps IMHO.

@amarshall amarshall deleted the zfs-pkgs-renaming branch March 5, 2024 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: clean-up 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 11-100 11.by: package-maintainer This PR was created by the maintainer of the package it changes 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in the package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants