diff --git a/pkgs/os-specific/linux/zfs/generic.nix b/pkgs/os-specific/linux/zfs/generic.nix index 347b4a29971..41aa909532f 100644 --- a/pkgs/os-specific/linux/zfs/generic.nix +++ b/pkgs/os-specific/linux/zfs/generic.nix @@ -54,13 +54,7 @@ stdenv'.mkDerivation { inherit rev sha256; }; - patches = [ - (fetchpatch { - name = "musl.patch"; - url = "https://github.com/openzfs/zfs/commit/1f19826c9ac85835cbde61a7439d9d1fefe43a4a.patch"; - sha256 = "XEaK227ubfOwlB2s851UvZ6xp/QOtYUWYsKTkEHzmo0="; - }) - ] ++ extraPatches; + patches = extraPatches; postPatch = optionalString buildKernel '' patchShebangs scripts @@ -82,31 +76,22 @@ stdenv'.mkDerivation { 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 ./etc/zfs/Makefile.am --replace "\$(sysconfdir)" "$out/etc" + # TODO: drop when upgrading to 2.2.0 + ${if isUnstable then '' + substituteInPlace ./contrib/initramfs/Makefile.am \ + --replace "/usr/share/initramfs-tools" "$out/usr/share/initramfs-tools" + substituteInPlace ./udev/vdev_id \ + --replace "PATH=/bin:/sbin:/usr/bin:/usr/sbin" \ + "PATH=${makeBinPath [ coreutils gawk gnused gnugrep systemd ]}" + '' else '' + substituteInPlace ./etc/zfs/Makefile.am --replace "\$(sysconfdir)/zfs" "$out/etc/zfs" - substituteInPlace ./contrib/initramfs/hooks/Makefile.am \ - --replace "/usr/share/initramfs-tools/hooks" "$out/usr/share/initramfs-tools/hooks" - substituteInPlace ./contrib/initramfs/Makefile.am \ - --replace "/usr/share/initramfs-tools" "$out/usr/share/initramfs-tools" - substituteInPlace ./contrib/initramfs/scripts/Makefile.am \ - --replace "/usr/share/initramfs-tools/scripts" "$out/usr/share/initramfs-tools/scripts" - substituteInPlace ./contrib/initramfs/scripts/local-top/Makefile.am \ - --replace "/usr/share/initramfs-tools/scripts/local-top" "$out/usr/share/initramfs-tools/scripts/local-top" - substituteInPlace ./contrib/initramfs/scripts/Makefile.am \ - --replace "/usr/share/initramfs-tools/scripts" "$out/usr/share/initramfs-tools/scripts" - substituteInPlace ./contrib/initramfs/scripts/local-top/Makefile.am \ - --replace "/usr/share/initramfs-tools/scripts/local-top" "$out/usr/share/initramfs-tools/scripts/local-top" - substituteInPlace ./etc/systemd/system/Makefile.am \ - --replace '$(DESTDIR)$(systemdunitdir)' "$out"'$(DESTDIR)$(systemdunitdir)' + find ./contrib/initramfs -name Makefile.am -exec sed -i -e 's|/usr/share/initramfs-tools|'$out'/share/initramfs-tools|g' {} \; - substituteInPlace ./contrib/initramfs/conf.d/Makefile.am \ - --replace "/usr/share/initramfs-tools/conf.d" "$out/usr/share/initramfs-tools/conf.d" - substituteInPlace ./contrib/initramfs/conf-hooks.d/Makefile.am \ - --replace "/usr/share/initramfs-tools/conf-hooks.d" "$out/usr/share/initramfs-tools/conf-hooks.d" - - substituteInPlace ./cmd/vdev_id/vdev_id \ - --replace "PATH=/bin:/sbin:/usr/bin:/usr/sbin" \ - "PATH=${makeBinPath [ coreutils gawk gnused gnugrep systemd ]}" + substituteInPlace ./cmd/vdev_id/vdev_id \ + --replace "PATH=/bin:/sbin:/usr/bin:/usr/sbin" \ + "PATH=${makeBinPath [ coreutils gawk gnused gnugrep systemd ]}" + ''} ''; nativeBuildInputs = [ autoreconfHook269 nukeReferences ] @@ -168,10 +153,12 @@ stdenv'.mkDerivation { # Remove provided services as they are buggy rm $out/etc/systemd/system/zfs-import-*.service - sed -i '/zfs-import-scan.service/d' $out/etc/systemd/system/* - for i in $out/etc/systemd/system/*; do - substituteInPlace $i --replace "zfs-import-cache.service" "zfs-import.target" + if [ -L $i ]; then + continue + fi + sed -i '/zfs-import-scan.service/d' $i + substituteInPlace $i --replace "zfs-import-cache.service" "zfs-import.target" done # Remove tests because they add a runtime dependency on gcc @@ -232,3 +219,4 @@ stdenv'.mkDerivation { broken = buildKernel && (kernelCompatible != null) && !kernelCompatible; }; } + diff --git a/pkgs/os-specific/linux/zfs/stable.nix b/pkgs/os-specific/linux/zfs/stable.nix index 5680f93e21a..14cda12e6f3 100644 --- a/pkgs/os-specific/linux/zfs/stable.nix +++ b/pkgs/os-specific/linux/zfs/stable.nix @@ -3,6 +3,7 @@ , stdenv , linuxKernel , removeLinuxDRM ? false +, fetchpatch , ... } @ args: @@ -16,6 +17,13 @@ callPackage ./generic.nix args { then kernel.kernelOlder "6.4" else kernel.kernelOlder "6.2"; latestCompatibleLinuxPackages = linuxKernel.packages.linux_6_1; + extraPatches = [ + (fetchpatch { + name = "musl.patch"; + url = "https://github.com/openzfs/zfs/commit/1f19826c9ac85835cbde61a7439d9d1fefe43a4a.patch"; + sha256 = "XEaK227ubfOwlB2s851UvZ6xp/QOtYUWYsKTkEHzmo0="; + }) + ]; # this package should point to the latest release. version = "2.1.12"; diff --git a/pkgs/os-specific/linux/zfs/unstable.nix b/pkgs/os-specific/linux/zfs/unstable.nix index 1bb882de712..592d94b0030 100644 --- a/pkgs/os-specific/linux/zfs/unstable.nix +++ b/pkgs/os-specific/linux/zfs/unstable.nix @@ -16,17 +16,16 @@ callPackage ./generic.nix args { else kernel.kernelOlder "6.2"; latestCompatibleLinuxPackages = if stdenv'.isx86_64 || removeLinuxDRM - then linuxKernel.packages.linux_6_4 - else linuxKernel.packages.linux_6_1; + then linuxKernel.packages.linux_6_4 + else linuxKernel.packages.linux_6_1; # this package should point to a version / git revision compatible with the latest kernel release # IMPORTANT: Always use a tagged release candidate or commits from the # zfs--staging branch, because this is tested by the OpenZFS # maintainers. - version = "2.1.13-unstable-2023-08-02"; - rev = "245850b66c1e93ec19744ca55aae143d007d2c32"; + version = "2.2.0-rc4"; - sha256 = "TtgKV02W8OfU6hssULF/IoFXAPHBTvTKXn5hJ/RGAc0="; + sha256 = "sha256-zTG6iujlWB2H8j6i+t59zdyztoDFk373AjgHzC8x5mQ="; isUnstable = true; }