From 2491be0a6ddfeb0fa54c26c5b22d05f79e384e23 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Wed, 30 Oct 2024 09:39:26 -0400 Subject: [PATCH 1/3] zfs: update usage of deprecated `--replace` - In some cases, move into a conditional as the substitution is only needed on some version - One use of `--replace-warn` since it is looking in a set of files where the exact files that might contain it may change over time, but we want to cover all of them --- pkgs/os-specific/linux/zfs/generic.nix | 34 +++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/pkgs/os-specific/linux/zfs/generic.nix b/pkgs/os-specific/linux/zfs/generic.nix index 56e37ec0b847..a7b16109f608 100644 --- a/pkgs/os-specific/linux/zfs/generic.nix +++ b/pkgs/os-specific/linux/zfs/generic.nix @@ -69,39 +69,39 @@ let # The arrays must remain the same length, so we repeat a flag that is # already part of the command and therefore has no effect. substituteInPlace ./module/os/linux/zfs/zfs_ctldir.c \ - --replace '"/usr/bin/env", "umount"' '"${util-linux}/bin/umount", "-n"' \ - --replace '"/usr/bin/env", "mount"' '"${util-linux}/bin/mount", "-n"' + --replace-fail '"/usr/bin/env", "umount"' '"${util-linux}/bin/umount", "-n"' \ + --replace-fail '"/usr/bin/env", "mount"' '"${util-linux}/bin/mount", "-n"' '' + optionalString buildUser '' - substituteInPlace ./lib/libshare/os/linux/nfs.c --replace "/usr/sbin/exportfs" "${ + substituteInPlace ./lib/libshare/os/linux/nfs.c --replace-fail "/usr/sbin/exportfs" "${ # We don't *need* python support, but we set it like this to minimize closure size: # If it's disabled by default, no need to enable it, even if we have python enabled # And if it's enabled by default, only change that if we explicitly disable python to remove python from the closure nfs-utils.override (old: { enablePython = old.enablePython or true && enablePython; }) }/bin/exportfs" - substituteInPlace ./lib/libshare/smb.h --replace "/usr/bin/net" "${samba}/bin/net" + substituteInPlace ./lib/libshare/smb.h --replace-fail "/usr/bin/net" "${samba}/bin/net" # Disable dynamic loading of libcurl - substituteInPlace ./config/user-libfetch.m4 --replace "curl-config --built-shared" "true" - substituteInPlace ./config/user-systemd.m4 --replace "/usr/lib/modules-load.d" "$out/etc/modules-load.d" - substituteInPlace ./config/zfs-build.m4 --replace "\$sysconfdir/init.d" "$out/etc/init.d" \ - --replace "/etc/default" "$out/etc/default" + substituteInPlace ./config/user-libfetch.m4 --replace-fail "curl-config --built-shared" "true" + substituteInPlace ./config/user-systemd.m4 --replace-fail "/usr/lib/modules-load.d" "$out/etc/modules-load.d" + substituteInPlace ./config/zfs-build.m4 --replace-fail "\$sysconfdir/init.d" "$out/etc/init.d" \ + --replace-fail "/etc/default" "$out/etc/default" substituteInPlace ./contrib/initramfs/Makefile.am \ - --replace "/usr/share/initramfs-tools" "$out/usr/share/initramfs-tools" + --replace-fail "/usr/share/initramfs-tools" "$out/usr/share/initramfs-tools" '' + optionalString isAtLeast22Series '' substituteInPlace ./udev/vdev_id \ - --replace "PATH=/bin:/sbin:/usr/bin:/usr/sbin" \ + --replace-fail "PATH=/bin:/sbin:/usr/bin:/usr/sbin" \ "PATH=${makeBinPath [ coreutils gawk gnused gnugrep systemd ]}" + + substituteInPlace ./config/zfs-build.m4 \ + --replace-fail "bashcompletiondir=/etc/bash_completion.d" \ + "bashcompletiondir=$out/share/bash-completion/completions" '' + optionalString (!isAtLeast22Series) '' - substituteInPlace ./etc/zfs/Makefile.am --replace "\$(sysconfdir)/zfs" "$out/etc/zfs" + substituteInPlace ./etc/zfs/Makefile.am --replace-fail "\$(sysconfdir)/zfs" "$out/etc/zfs" find ./contrib/initramfs -name Makefile.am -exec sed -i -e 's|/usr/share/initramfs-tools|'$out'/share/initramfs-tools|g' {} \; substituteInPlace ./cmd/vdev_id/vdev_id \ - --replace "PATH=/bin:/sbin:/usr/bin:/usr/sbin" \ + --replace-fail "PATH=/bin:/sbin:/usr/bin:/usr/sbin" \ "PATH=${makeBinPath [ coreutils gawk gnused gnugrep systemd ]}" - '' + '' - substituteInPlace ./config/zfs-build.m4 \ - --replace "bashcompletiondir=/etc/bash_completion.d" \ - "bashcompletiondir=$out/share/bash-completion/completions" ''; nativeBuildInputs = [ autoreconfHook269 nukeReferences ] @@ -176,7 +176,7 @@ let continue fi sed -i '/zfs-import-scan.service/d' $i - substituteInPlace $i --replace "zfs-import-cache.service" "zfs-import.target" + substituteInPlace $i --replace-warn "zfs-import-cache.service" "zfs-import.target" done # Remove tests because they add a runtime dependency on gcc From 9ce881027b195742f0c2e373e0c4f5199adf251a Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Wed, 30 Oct 2024 10:00:33 -0400 Subject: [PATCH 2/3] zfs: remove recommendations to use unstable `pkgs.zfs_unstable` is pre-release software and may very well have critical bugs that make it unsuitable for general use. As such, we should not recommend it as a general solution to the problem of "my Kernel is too new for stable ZFS". --- nixos/modules/tasks/filesystems/zfs.nix | 2 +- pkgs/os-specific/linux/zfs/generic.nix | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/nixos/modules/tasks/filesystems/zfs.nix b/nixos/modules/tasks/filesystems/zfs.nix index d4ed269efc6c..87876867c572 100644 --- a/nixos/modules/tasks/filesystems/zfs.nix +++ b/nixos/modules/tasks/filesystems/zfs.nix @@ -221,7 +221,7 @@ in type = lib.types.package; default = pkgs.zfs; defaultText = lib.literalExpression "pkgs.zfs"; - description = "Configured ZFS userland tools package, use `pkgs.zfs_unstable` if you want to track the latest staging ZFS branch."; + description = "Configured ZFS userland tools package."; }; modulePackage = lib.mkOption { diff --git a/pkgs/os-specific/linux/zfs/generic.nix b/pkgs/os-specific/linux/zfs/generic.nix index a7b16109f608..cf1bb132223e 100644 --- a/pkgs/os-specific/linux/zfs/generic.nix +++ b/pkgs/os-specific/linux/zfs/generic.nix @@ -237,8 +237,6 @@ 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.package = pkgs.zfs_unstable`. broken = buildKernel && (kernelCompatible != null) && !(kernelCompatible kernel); }; }; From b5e959d3c39451f4b26ec66904a9ea7286eba66d Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Wed, 30 Oct 2024 10:05:11 -0400 Subject: [PATCH 3/3] zfs_unstable: expand on unstable nature in long description --- pkgs/os-specific/linux/zfs/generic.nix | 3 ++- pkgs/os-specific/linux/zfs/unstable.nix | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/os-specific/linux/zfs/generic.nix b/pkgs/os-specific/linux/zfs/generic.nix index cf1bb132223e..3f6a1c71dc75 100644 --- a/pkgs/os-specific/linux/zfs/generic.nix +++ b/pkgs/os-specific/linux/zfs/generic.nix @@ -26,6 +26,7 @@ let { version , hash , kernelModuleAttribute + , extraLongDescription ? "" , extraPatches ? [] , rev ? "zfs-${version}" , kernelCompatible ? null @@ -220,7 +221,7 @@ let snapshotting, cloning, block devices, deduplication, and more. ${if buildUser then "This is the userspace tools package." else "This is the kernel module package."} - ''; + '' + extraLongDescription; homepage = "https://github.com/openzfs/zfs"; changelog = "https://github.com/openzfs/zfs/releases/tag/zfs-${version}"; license = lib.licenses.cddl; diff --git a/pkgs/os-specific/linux/zfs/unstable.nix b/pkgs/os-specific/linux/zfs/unstable.nix index 0d75c8c7072c..7590481b6efb 100644 --- a/pkgs/os-specific/linux/zfs/unstable.nix +++ b/pkgs/os-specific/linux/zfs/unstable.nix @@ -28,4 +28,9 @@ callPackage ./generic.nix args { }; hash = "sha256-/INlfiPpRm5JprcORzJJKyjpGIMY1LceY3yZ811uf2A="; + + extraLongDescription = '' + This is "unstable" ZFS, and will usually be a pre-release version of ZFS. + It may be less well-tested and have critical bugs. + ''; }