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: remove recommendations to use zfs_unstable, update deprecated --replace #352386

Merged
merged 3 commits into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nixos/modules/tasks/filesystems/zfs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
39 changes: 19 additions & 20 deletions pkgs/os-specific/linux/zfs/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ let
{ version
, hash
, kernelModuleAttribute
, extraLongDescription ? ""
, extraPatches ? []
, rev ? "zfs-${version}"
, kernelCompatible ? null
Expand Down Expand Up @@ -69,39 +70,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 ]
Expand Down Expand Up @@ -176,7 +177,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
Expand Down Expand Up @@ -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;
Expand All @@ -237,8 +238,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);
};
};
Expand Down
5 changes: 5 additions & 0 deletions pkgs/os-specific/linux/zfs/unstable.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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.
'';
}