Skip to content

zfs: make kernel packages overridable - #230498

Merged
Mic92 merged 1 commit into
NixOS:masterfrom
Mic92:zfs-overridable
May 14, 2023
Merged

Mic92 merged 1 commit into
NixOS:masterfrom
Mic92:zfs-overridable

Conversation

@Mic92

@Mic92 Mic92 commented May 7, 2023 •

Copy link
Copy Markdown
Member

We do not have callPackages (notice the s) for kernel packages. Hence it's not override zfs dependencies as we do not have an override function. This is fixed by splitting of the file into a generic builder function and 2 files for zfsStable and zfsUnstable.

Description of changes
Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • 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/)
  • 23.05 Release Notes (or backporting 22.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.

@Mic92
Mic92 requested a review from RaitoBezarius May 7, 2023 10:58
@Mic92

Mic92 commented May 7, 2023

Copy link
Copy Markdown
Member Author
nix-repl> linuxPackages.zfsUnstable.override
{ __functionArgs = { ... }; __functor = «lambda @ /home/joerg/git/nixpkgs/lib/trivial.nix:430:19»; }

@Mic92
Mic92 force-pushed the zfs-overridable branch 2 times, most recently from 2f5b656 to 94f4ff9 Compare May 7, 2023 11:10
@Mic92

Mic92 commented May 7, 2023

Copy link
Copy Markdown
Member Author

@ofborg test zfs

We do not have callPackages (notice the s) for kernel packages. Hence
it's not override zfs dependencies as we do not have an override
function. This is fixed by splitting of the file into a generic builder
function and 2 files for zfsStable and zfsUnstable.
@Mic92
Mic92 force-pushed the zfs-overridable branch from 94f4ff9 to cfe5a79 Compare May 7, 2023 11:17
@ofborg ofborg Bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels May 7, 2023

@RaitoBezarius RaitoBezarius left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@mweinelt mweinelt added the 12.approvals: 1 This PR was reviewed and approved by one person. label May 7, 2023

@PedroHLC PedroHLC left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks ♾️ better to me!

@Mic92
Mic92 merged commit 22f3e94 into NixOS:master May 14, 2023
@Mic92
Mic92 deleted the zfs-overridable branch May 14, 2023 14:15
Comment on lines +17 to +20
latestCompatibleLinuxPackages =
if stdenv'.isx86_64
then linuxKernel.packages.linux_6_1
else linuxKernel.packages.linux_6_2;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did you intentionally flip the then and else? I'm currently using zfs with kernel 6.2 and this would mean a downgrade to 6.1 for me.

@azahi

azahi commented May 17, 2023

Copy link
Copy Markdown
Member

Was it intentional to mark kernel packages broken on all versions except linux_6_1 and linux_6_2? Setting anything other than these two (e.g. the most recent kernel) now prevents me from building my system without allowing broken packages. Setting boot.zfs.enableUnstable = true doesn't help at all. This used to work before :(

@PedroHLC

Copy link
Copy Markdown
Member

Was it intentional

Did you intentionally flip

Pretty sure it wasn't guys.

If it affects you, please open a PR to fasten things up, add Mic92 as a reviewer, and if he has a better solution or disagrees he'll reply.

Remember that nixpkgs is complicated, giant and error-prone, so be kind and offer help before shouting.

@hydrogenoxide

Copy link
Copy Markdown
Contributor

I apologize if my comment came of passive aggressive. That wasn't my intention.

I opened #232460 to fix this.

@evrim

evrim commented May 24, 2023

Copy link
Copy Markdown
Contributor

Basically, I want to override the params in generic.nix but repl says otherwise. Prolly, I'm missing the point.

nix-repl> linuxPackages.zfsUnstable.override.__functionArgs
{ callPackage = false; kernel = true; linuxKernel = false; stdenv = false; }

@Mic92

Mic92 commented May 24, 2023

Copy link
Copy Markdown
Member Author

Basically, I want to override the params in generic.nix but repl says otherwise. Prolly, I'm missing the point.

nix-repl> linuxPackages.zfsUnstable.override.__functionArgs
{ callPackage = false; kernel = true; linuxKernel = false; stdenv = false; }

This should work. All args are forwarded to generic.nix as well.

https://github.com/NixOS/nixpkgs/pull/230498/files#diff-9b7bfd29417217b6e3f9ebe9215e7668cbd33b2e54c39afc8d75e579b27a506bR11

I am actually doing this for my systems.

@evrim

evrim commented May 24, 2023

Copy link
Copy Markdown
Contributor

zfs = import (modulesPath + "../generic.nix") { .. } { .. } works for me. The two discrete attrSets fun was surprising though, any particular reason for having such, could they be merged?

@evrim

evrim commented May 24, 2023

Copy link
Copy Markdown
Contributor

Or better, should I ask, how to override a parameter in the first set and how to override one in the latter set?

@PedroHLC

PedroHLC commented May 24, 2023 •

Copy link
Copy Markdown
Member

I can attest that linuxPackages_*.zfs*.override{,Attrs} works flawlessly after this PR. imports is another story, but there are no reasons for it to not work.

If you need to override it inside a linuxPackages_*, it's an "extendable" attrset, so remember to use .extend.

@evrim

evrim commented May 24, 2023

Copy link
Copy Markdown
Contributor

Yes I am aware of extend and friends. I wonder if we can find a way to implement a method to override both kernel/user derivations at the same time since one of them is under linuxPackages.

@n0099 n0099 mentioned this pull request Jul 21, 2026
2 of 13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants