From dcff4f831836e249db5e808aeac6ca71d498cdc7 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sat, 27 Jan 2024 11:15:29 -0500 Subject: [PATCH 1/7] zfs_2_2: Rename from zfsStable 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. --- nixos/tests/zfs.nix | 10 +++++----- pkgs/os-specific/linux/zfs/{stable.nix => 2_2.nix} | 4 ++-- pkgs/top-level/aliases.nix | 1 + pkgs/top-level/all-packages.nix | 4 ++-- pkgs/top-level/linux-kernels.nix | 4 ++-- 5 files changed, 12 insertions(+), 11 deletions(-) rename pkgs/os-specific/linux/zfs/{stable.nix => 2_2.nix} (90%) diff --git a/nixos/tests/zfs.nix b/nixos/tests/zfs.nix index 0b411b0b9d8a5..a9bf666075749 100644 --- a/nixos/tests/zfs.nix +++ b/nixos/tests/zfs.nix @@ -192,22 +192,22 @@ let in { # maintainer: @raitobezarius - series_2_1 = makeZfsTest "2.1-series" { + series_2_1 = makeZfsTest "zfs_2_1" { zfsPackage = pkgs.zfs_2_1; kernelPackages = pkgs.linuxPackages; }; - stable = makeZfsTest "stable" { - zfsPackage = pkgs.zfsStable; + series_2_2 = makeZfsTest "zfs_2_2" { + zfsPackage = pkgs.zfs_2_2; kernelPackages = pkgs.linuxPackages; }; - unstable = makeZfsTest "unstable" rec { + unstable = makeZfsTest "zfsUnstable" rec { zfsPackage = pkgs.zfsUnstable; kernelPackages = zfsPackage.latestCompatibleLinuxPackages; }; - unstableWithSystemdStage1 = makeZfsTest "unstable" rec { + unstableWithSystemdStage1 = makeZfsTest "zfsUnstable" rec { zfsPackage = pkgs.zfsUnstable; kernelPackages = zfsPackage.latestCompatibleLinuxPackages; enableSystemdStage1 = true; diff --git a/pkgs/os-specific/linux/zfs/stable.nix b/pkgs/os-specific/linux/zfs/2_2.nix similarity index 90% rename from pkgs/os-specific/linux/zfs/stable.nix rename to pkgs/os-specific/linux/zfs/2_2.nix index 7ca1d5be3787d..3e5d262f73d06 100644 --- a/pkgs/os-specific/linux/zfs/stable.nix +++ b/pkgs/os-specific/linux/zfs/2_2.nix @@ -12,7 +12,7 @@ in callPackage ./generic.nix args { # You have to ensure that in `pkgs/top-level/linux-kernels.nix` # this attribute is the correct one for this package. - kernelModuleAttribute = "zfs"; + kernelModuleAttribute = "zfs_2_2"; # check the release notes for compatible kernels kernelCompatible = kernel.kernelOlder "6.8"; @@ -23,7 +23,7 @@ callPackage ./generic.nix args { tests = [ nixosTests.zfs.installer - nixosTests.zfs.stable + nixosTests.zfs.series_2_2 ]; hash = "sha256-Bzkow15OitUUQ+mTYhCXgTrQl+ao/B4feleHY/rSSjg="; diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 5d0ef64bf9a60..ddfed4a09550c 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -1211,6 +1211,7 @@ mapAliases ({ ### Z ### zabbix40 = throw "'zabbix40' has been removed as it has reached end of life"; # Added 2024-01-07 + zfsStable = zfs; # Added 2024-02-26 zinc = zincsearch; # Added 2023-05-28 zkg = throw "'zkg' has been replaced by 'zeek'"; zq = zed.overrideAttrs (old: { meta = old.meta // { mainProgram = "zq"; }; }); # Added 2023-02-06 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e8a5bb73d67ba..6d4f19c255e01 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -28729,13 +28729,13 @@ with pkgs; 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 { configFile = "user"; }; - zfs = zfsStable; + zfs = zfs_2_2; ### DATA diff --git a/pkgs/top-level/linux-kernels.nix b/pkgs/top-level/linux-kernels.nix index 47838b60569fb..7df1bb0c0081b 100644 --- a/pkgs/top-level/linux-kernels.nix +++ b/pkgs/top-level/linux-kernels.nix @@ -565,7 +565,7 @@ in { configFile = "kernel"; inherit pkgs kernel; }; - zfsStable = callPackage ../os-specific/linux/zfs/stable.nix { + zfs_2_2 = callPackage ../os-specific/linux/zfs/2_2.nix { configFile = "kernel"; inherit pkgs kernel; }; @@ -573,7 +573,7 @@ in { configFile = "kernel"; inherit pkgs kernel; }; - zfs = zfsStable; + zfs = zfs_2_2; can-isotp = callPackage ../os-specific/linux/can-isotp { }; From 1c846675398059067b6ad147abc6a7877c4b8368 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sat, 27 Jan 2024 12:17:29 -0500 Subject: [PATCH 2/7] nixos/tests/zfs: Get test name from pkg under test The previous names are already this. --- nixos/tests/zfs.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nixos/tests/zfs.nix b/nixos/tests/zfs.nix index a9bf666075749..4bc608ac75e55 100644 --- a/nixos/tests/zfs.nix +++ b/nixos/tests/zfs.nix @@ -7,14 +7,14 @@ with import ../lib/testing-python.nix { inherit system pkgs; }; let - makeZfsTest = name: + makeZfsTest = { kernelPackages , enableSystemdStage1 ? false , zfsPackage , extraTest ? "" }: makeTest { - name = "zfs-" + name; + name = zfsPackage.kernelModuleAttribute; meta = with pkgs.lib.maintainers; { maintainers = [ elvishjerricco ]; }; @@ -192,22 +192,22 @@ let in { # maintainer: @raitobezarius - series_2_1 = makeZfsTest "zfs_2_1" { + series_2_1 = makeZfsTest { zfsPackage = pkgs.zfs_2_1; kernelPackages = pkgs.linuxPackages; }; - series_2_2 = makeZfsTest "zfs_2_2" { + series_2_2 = makeZfsTest { zfsPackage = pkgs.zfs_2_2; kernelPackages = pkgs.linuxPackages; }; - unstable = makeZfsTest "zfsUnstable" rec { + unstable = makeZfsTest rec { zfsPackage = pkgs.zfsUnstable; kernelPackages = zfsPackage.latestCompatibleLinuxPackages; }; - unstableWithSystemdStage1 = makeZfsTest "zfsUnstable" rec { + unstableWithSystemdStage1 = makeZfsTest rec { zfsPackage = pkgs.zfsUnstable; kernelPackages = zfsPackage.latestCompatibleLinuxPackages; enableSystemdStage1 = true; From ce5b1e007e1eb96e5df296e33ed884b70dc19250 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Tue, 27 Feb 2024 18:26:54 -0500 Subject: [PATCH 3/7] nixos/zfs: Fix typo in option doc --- nixos/modules/tasks/filesystems/zfs.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/tasks/filesystems/zfs.nix b/nixos/modules/tasks/filesystems/zfs.nix index c6a153cfcb2d7..6939a01d65897 100644 --- a/nixos/modules/tasks/filesystems/zfs.nix +++ b/nixos/modules/tasks/filesystems/zfs.nix @@ -220,7 +220,7 @@ in package = mkOption { type = types.package; default = if cfgZfs.enableUnstable then pkgs.zfsUnstable else pkgs.zfs; - defaultText = literalExpression "if zfsUnstable is enabled then pkgs.zfsUnstable else pkgs.zfs"; + defaultText = literalExpression "if enableUnstable is enabled then pkgs.zfsUnstable else pkgs.zfs"; description = lib.mdDoc "Configured ZFS userland tools package, use `pkgs.zfsUnstable` if you want to track the latest staging ZFS branch."; }; From 929fcf93358a833003435c0f74b9bd993f9546d0 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Tue, 27 Feb 2024 18:27:39 -0500 Subject: [PATCH 4/7] zfs_unstable: Rename from zfsUnstable This matches the naming of other zfs_* pkgs. --- nixos/modules/tasks/filesystems/zfs.nix | 6 +++--- nixos/tests/zfs.nix | 4 ++-- pkgs/os-specific/linux/zfs/generic.nix | 2 +- pkgs/os-specific/linux/zfs/unstable.nix | 2 +- pkgs/top-level/aliases.nix | 1 + pkgs/top-level/all-packages.nix | 2 +- pkgs/top-level/linux-kernels.nix | 2 +- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/nixos/modules/tasks/filesystems/zfs.nix b/nixos/modules/tasks/filesystems/zfs.nix index 6939a01d65897..b5caa4d29fa97 100644 --- a/nixos/modules/tasks/filesystems/zfs.nix +++ b/nixos/modules/tasks/filesystems/zfs.nix @@ -219,9 +219,9 @@ in boot.zfs = { package = mkOption { type = types.package; - default = if cfgZfs.enableUnstable then pkgs.zfsUnstable else pkgs.zfs; - defaultText = literalExpression "if enableUnstable is enabled then pkgs.zfsUnstable else pkgs.zfs"; - description = lib.mdDoc "Configured ZFS userland tools package, use `pkgs.zfsUnstable` if you want to track the latest staging ZFS branch."; + default = if cfgZfs.enableUnstable then pkgs.zfs_unstable else pkgs.zfs; + defaultText = literalExpression "if enableUnstable is enabled then pkgs.zfs_unstable else pkgs.zfs"; + description = lib.mdDoc "Configured ZFS userland tools package, use `pkgs.zfs_unstable` if you want to track the latest staging ZFS branch."; }; modulePackage = mkOption { diff --git a/nixos/tests/zfs.nix b/nixos/tests/zfs.nix index 4bc608ac75e55..851fced2c5e1e 100644 --- a/nixos/tests/zfs.nix +++ b/nixos/tests/zfs.nix @@ -203,12 +203,12 @@ in { }; unstable = makeZfsTest rec { - zfsPackage = pkgs.zfsUnstable; + zfsPackage = pkgs.zfs_unstable; kernelPackages = zfsPackage.latestCompatibleLinuxPackages; }; unstableWithSystemdStage1 = makeZfsTest rec { - zfsPackage = pkgs.zfsUnstable; + zfsPackage = pkgs.zfs_unstable; kernelPackages = zfsPackage.latestCompatibleLinuxPackages; enableSystemdStage1 = true; }; diff --git a/pkgs/os-specific/linux/zfs/generic.nix b/pkgs/os-specific/linux/zfs/generic.nix index 566af6950d483..e5a3a79eba3ab 100644 --- a/pkgs/os-specific/linux/zfs/generic.nix +++ b/pkgs/os-specific/linux/zfs/generic.nix @@ -234,7 +234,7 @@ let inherit maintainers; mainProgram = "zfs"; - # If your Linux kernel version is not yet supported by zfs, try zfsUnstable. + # If your Linux kernel version is not yet supported by zfs, try zfs_unstable. # On NixOS set the option boot.zfs.enableUnstable. broken = buildKernel && (kernelCompatible != null) && !kernelCompatible; }; diff --git a/pkgs/os-specific/linux/zfs/unstable.nix b/pkgs/os-specific/linux/zfs/unstable.nix index 2bd06e0d6b749..052dd0cd74c9a 100644 --- a/pkgs/os-specific/linux/zfs/unstable.nix +++ b/pkgs/os-specific/linux/zfs/unstable.nix @@ -12,7 +12,7 @@ in callPackage ./generic.nix args { # You have to ensure that in `pkgs/top-level/linux-kernels.nix` # this attribute is the correct one for this package. - kernelModuleAttribute = "zfsUnstable"; + kernelModuleAttribute = "zfs_unstable"; # check the release notes for compatible kernels kernelCompatible = kernel.kernelOlder "6.9"; diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index ddfed4a09550c..fab717bc0d1d4 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -1212,6 +1212,7 @@ mapAliases ({ zabbix40 = throw "'zabbix40' has been removed as it has reached end of life"; # Added 2024-01-07 zfsStable = zfs; # Added 2024-02-26 + zfsUnstable = zfs_unstable; # Added 2024-02-26 zinc = zincsearch; # Added 2023-05-28 zkg = throw "'zkg' has been replaced by 'zeek'"; zq = zed.overrideAttrs (old: { meta = old.meta // { mainProgram = "zq"; }; }); # Added 2023-02-06 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6d4f19c255e01..b292d5952e9dd 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -28732,7 +28732,7 @@ with pkgs; 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 = zfs_2_2; diff --git a/pkgs/top-level/linux-kernels.nix b/pkgs/top-level/linux-kernels.nix index 7df1bb0c0081b..f54280683b9c5 100644 --- a/pkgs/top-level/linux-kernels.nix +++ b/pkgs/top-level/linux-kernels.nix @@ -569,7 +569,7 @@ in { configFile = "kernel"; inherit pkgs kernel; }; - zfsUnstable = callPackage ../os-specific/linux/zfs/unstable.nix { + zfs_unstable = callPackage ../os-specific/linux/zfs/unstable.nix { configFile = "kernel"; inherit pkgs kernel; }; From 2e36c49949f90f14a2ffcc002c8f411b725022d2 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Tue, 27 Feb 2024 18:31:29 -0500 Subject: [PATCH 5/7] nixos/pam: Do not incorrectly use zfs.enableUnstable in assertion `zfs.enableUnstable` only has an effect if `zfs.enabled = true`, so only require `zfs.enabled` to be true here. --- nixos/modules/security/pam.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/modules/security/pam.nix b/nixos/modules/security/pam.nix index ed03254cb5ee5..cd10a9b500ee5 100644 --- a/nixos/modules/security/pam.nix +++ b/nixos/modules/security/pam.nix @@ -1458,9 +1458,9 @@ in ''; } { - assertion = config.security.pam.zfs.enable -> (config.boot.zfs.enabled || config.boot.zfs.enableUnstable); + assertion = config.security.pam.zfs.enable -> config.boot.zfs.enabled; message = '' - `security.pam.zfs.enable` requires enabling ZFS (`boot.zfs.enabled` or `boot.zfs.enableUnstable`). + `security.pam.zfs.enable` requires enabling ZFS (`boot.zfs.enabled`). ''; } { From 1f32eb724ddc9e27573266756c390a6bdcca4439 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Tue, 27 Feb 2024 18:32:33 -0500 Subject: [PATCH 6/7] nixos/zfs: Remove enableUnstable in favor of setting package 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. --- nixos/modules/tasks/filesystems/zfs.nix | 18 +++--------------- pkgs/os-specific/linux/zfs/generic.nix | 2 +- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/nixos/modules/tasks/filesystems/zfs.nix b/nixos/modules/tasks/filesystems/zfs.nix index b5caa4d29fa97..7bb2d973647d0 100644 --- a/nixos/modules/tasks/filesystems/zfs.nix +++ b/nixos/modules/tasks/filesystems/zfs.nix @@ -211,6 +211,7 @@ in imports = [ (mkRemovedOptionModule [ "boot" "zfs" "enableLegacyCrypto" ] "The corresponding package was removed from nixpkgs.") + (mkRemovedOptionModule [ "boot" "zfs" "enableUnstable" ] "Instead set `boot.zfs.package = pkgs.zfs_unstable;`") ]; ###### interface @@ -219,8 +220,8 @@ in boot.zfs = { package = mkOption { type = types.package; - default = if cfgZfs.enableUnstable then pkgs.zfs_unstable else pkgs.zfs; - defaultText = literalExpression "if enableUnstable is enabled then pkgs.zfs_unstable else pkgs.zfs"; + default = pkgs.zfs; + defaultText = literalExpression "pkgs.zfs"; description = lib.mdDoc "Configured ZFS userland tools package, use `pkgs.zfs_unstable` if you want to track the latest staging ZFS branch."; }; @@ -239,19 +240,6 @@ in description = lib.mdDoc "True if ZFS filesystem support is enabled"; }; - enableUnstable = mkOption { - type = types.bool; - default = false; - description = lib.mdDoc '' - Use the unstable zfs package. This might be an option, if the latest - kernel is not yet supported by a published release of ZFS. Enabling - this option will install a development version of ZFS on Linux. The - version will have already passed an extensive test suite, but it is - more likely to hit an undiscovered bug compared to running a released - version of ZFS on Linux. - ''; - }; - allowHibernation = mkOption { type = types.bool; default = false; diff --git a/pkgs/os-specific/linux/zfs/generic.nix b/pkgs/os-specific/linux/zfs/generic.nix index e5a3a79eba3ab..c0ff834cb34ab 100644 --- a/pkgs/os-specific/linux/zfs/generic.nix +++ b/pkgs/os-specific/linux/zfs/generic.nix @@ -235,7 +235,7 @@ let inherit maintainers; mainProgram = "zfs"; # If your Linux kernel version is not yet supported by zfs, try zfs_unstable. - # On NixOS set the option boot.zfs.enableUnstable. + # On NixOS set the option `boot.zfs.package = pkgs.zfs_unstable`. broken = buildKernel && (kernelCompatible != null) && !kernelCompatible; }; }; From 29a1b11f916e5994f7ad23039ae21945df99247c Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Fri, 1 Mar 2024 08:20:58 -0500 Subject: [PATCH 7/7] zfs_*: Avoid failing pkgs/by-name migration check See also https://github.com/NixOS/nixpkgs/pull/292214 --- pkgs/top-level/all-packages.nix | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b292d5952e9dd..16ed76753c96f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -28726,15 +28726,21 @@ with pkgs; zenmonitor = callPackage ../os-specific/linux/zenmonitor { }; - zfs_2_1 = callPackage ../os-specific/linux/zfs/2_1.nix { - configFile = "user"; - }; - zfs_2_2 = callPackage ../os-specific/linux/zfs/2_2.nix { - configFile = "user"; - }; - zfs_unstable = callPackage ../os-specific/linux/zfs/unstable.nix { - configFile = "user"; - }; + inherit + ({ + zfs_2_1 = callPackage ../os-specific/linux/zfs/2_1.nix { + configFile = "user"; + }; + zfs_2_2 = callPackage ../os-specific/linux/zfs/2_2.nix { + configFile = "user"; + }; + zfs_unstable = callPackage ../os-specific/linux/zfs/unstable.nix { + configFile = "user"; + }; + }) + zfs_2_1 + zfs_2_2 + zfs_unstable; zfs = zfs_2_2; ### DATA