1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-19 04:02:10 +00:00

Merge pull request #136446 from lovesegfault/zfs-fix-stdenv

This commit is contained in:
Bernardo Meurer 2021-09-02 23:41:39 +00:00 committed by GitHub
commit 70988a3f6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -26,6 +26,14 @@ let
buildKernel = any (n: n == configFile) [ "kernel" "all" ];
buildUser = any (n: n == configFile) [ "user" "all" ];
# XXX: You always want to build kernel modules with the same stdenv as the
# kernel was built with. However, since zfs can also be built for userspace we
# need to correctly pick between the provided/default stdenv, and the one used
# by the kernel.
# If you don't do this your ZFS builds will fail on any non-standard (e.g.
# clang-built) kernels.
stdenv' = if kernel == null then stdenv else kernel.stdenv;
common = { version
, sha256
, extraPatches ? []
@ -34,7 +42,7 @@ let
, latestCompatibleLinuxPackages
, kernelCompatible ? null }:
stdenv.mkDerivation {
stdenv'.mkDerivation {
name = "zfs-${configFile}-${version}${optionalString buildKernel "-${kernel.version}"}";
src = fetchFromGitHub {
@ -47,11 +55,6 @@ let
postPatch = optionalString buildKernel ''
patchShebangs scripts
# https://github.com/openzfs/zfs/issues/10107
substituteInPlace ./config/kernel.m4 \
--replace "make modules" "make CC=$CC modules"
# 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 \