Skip to content

zfs-kernel: invalid variable name: `KERNEL_KCFLAGS+' #473637

Closed as not planned
Closed as not planned

Description

@Al2Klimov

Nixpkgs version

  • Unstable (26.05)

Describe the bug

If I add this snippet to my config, the ZFS kernel module fails to build:

boot.kernelPackages = pkgs.linuxPackagesFor (pkgs.linux.override {
  extraMakeFlags = [
    "KCFLAGS+=-march=icelake-client"
    "KCFLAGS+=-mtune=icelake-client"
  ];
});

A plain ext4 system takes a day, but it succeeds.

Steps to reproduce

For contrast, these configs build quickly. They're very basic, though.

Root on ext4

/etc/nixos/configuration.nix
{ config, lib, pkgs, ... }:
{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];
boot.loader.grub.device = "/dev/vda";
boot.kernelParams = [ "console=ttyS0,115200n8" ];
  boot.loader.grub.enable = true;
  system.stateVersion = "25.05"; # Did you read the comment?
}
/etc/nixos/hardware-configuration.nix
{ config, lib, pkgs, modulesPath, ... }:
{
  imports =
    [ (modulesPath + "/profiles/qemu-guest.nix")
    ];
  boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sr_mod" "virtio_blk" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-intel" ];
  boot.extraModulePackages = [ ];
  fileSystems."/" =
    { device = "/dev/disk/by-uuid/e8f47036-a035-430b-be6a-7f3a8a565644";
      fsType = "ext4";
    };
  swapDevices = [ ];
  networking.useDHCP = lib.mkDefault true;
  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

Root on ZFS

/etc/nixos/configuration.nix
{ config, lib, pkgs, ... }:
{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];
boot.loader.grub.device = "/dev/vda";
boot.kernelParams = [ "console=ttyS0,115200n8" "zfs.zfs_arc_max=268435456" ];
networking.hostId = "fd70ea62";
  boot.loader.grub.enable = true;
  system.stateVersion = "25.05"; # Did you read the comment?
}
/etc/nixos/hardware-configuration.nix
{ config, lib, pkgs, modulesPath, ... }:
{
  imports =
    [ (modulesPath + "/profiles/qemu-guest.nix")
    ];
boot.zfs.devNodes = "/dev";
  boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sr_mod" "virtio_blk" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-intel" ];
  boot.extraModulePackages = [ ];
  fileSystems."/" =
    { device = "zroot";
      fsType = "zfs";
    };
  fileSystems."/boot" =
    { device = "/dev/disk/by-uuid/d1d68f57-f2b5-4bdc-a87a-6ab8fc8cee2b";
      fsType = "ext2";
    };
  swapDevices = [ ];
  networking.useDHCP = lib.mkDefault true;
  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

Expected behaviour

zfs-kernel appends -march=icelake-client and -mtune=icelake-client to KCFLAGS, just like the kernel itself.

Screenshots

No response

Relevant log output

building the system configuration...
these 7 derivations will be built:
  /nix/store/kb9igdg84gkililfbvshivdxlhbh2h8l-zfs-kernel-2.3.5-6.12.62.drv
  /nix/store/vkakk74cf3cwg74pr7gmdq2crl0idhkg-linux-6.12.62-modules.drv
  /nix/store/1d22mpxjhmhx9xk31w2nii3flf3qg5cd-linux-6.12.62-modules-shrunk.drv
  /nix/store/2b3cgsbjf2c5hz6drcvsxssy44jy76l1-closure-info.drv
  /nix/store/svycmn823bafg83zhaiwz0imjhby5h2n-initrd-linux-6.12.62.drv
  /nix/store/rhg0diwgk15f9irz6bqjdkywr8lj1fr7-boot.json.drv
  /nix/store/29vanxrwvgf9jvmbk18wcq793gsxa3y3-nixos-system-nixos-26.05pre913595.c6245e83d836.drv
building '/nix/store/kb9igdg84gkililfbvshivdxlhbh2h8l-zfs-kernel-2.3.5-6.12.62.drv'...
Running phase: unpackPhase
unpacking source archive /nix/store/9v5ai3gxzamycywxkp76azmcfrn6vd70-source
source root is source
Running phase: patchPhase
applying patch /nix/store/arr60xb0ivwxpkfb28s994b6wvqnc2bc-fix_llvm-21_-wuninitialized-const-pointer_warning.patch
patching file config/kernel-blkdev.m4
patching script interpreter paths in scripts
scripts/convert_wycheproof.pl: interpreter directive changed from "#!/usr/bin/env perl" to "/nix/store/h2jsb5i4yfblr2f3ac2c7zpmlmj7zjym-perl-5.40.0/bin/perl"
scripts/zimport.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin/bash"
scripts/kmodtool: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin/bash"
scripts/spdxcheck.pl: interpreter directive changed from "#!/usr/bin/env perl" to "/nix/store/h2jsb5i4yfblr2f3ac2c7zpmlmj7zjym-perl-5.40.0/bin/perl"
scripts/zfs.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin/sh"
scripts/cstyle.pl: interpreter directive changed from "#!/usr/bin/env perl" to "/nix/store/h2jsb5i4yfblr2f3ac2c7zpmlmj7zjym-perl-5.40.0/bin/perl"
scripts/zloop.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin/bash"
scripts/dkms.mkconf: interpreter directive changed from "#!/bin/sh" to "/nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin/sh"
scripts/zfs-helpers.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin/sh"
scripts/zfs_prepare_disk: interpreter directive changed from "#!/bin/sh" to "/nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin/sh"
scripts/update_authors.pl: interpreter directive changed from "#!/usr/bin/env perl" to "/nix/store/h2jsb5i4yfblr2f3ac2c7zpmlmj7zjym-perl-5.40.0/bin/perl"
scripts/mancheck.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin/sh"
scripts/zol2zfs-patch.sed: interpreter directive changed from "#!/bin/sed -f" to "/nix/store/drc7kang929jaza6cy9zdx10s4gw1z5p-gnused-4.9/bin/sed -f"
scripts/dkms.postbuild: interpreter directive changed from "#!/bin/sh" to "/nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin/sh"
scripts/commitcheck.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin/sh"
scripts/zfs2zol-patch.sed: interpreter directive changed from "#!/bin/sed -f" to "/nix/store/drc7kang929jaza6cy9zdx10s4gw1z5p-gnused-4.9/bin/sed -f"
scripts/zfs-tests-color.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin/sh"
scripts/paxcheck.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin/sh"
scripts/man-dates.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin/sh"
scripts/zfs-tests.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin/bash"
scripts/make_gitrev.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin/sh"
Supported Kernel versions:
Linux-Maximum: 6.17
Linux-Minimum: 4.18
Checking kernelMinSupportedMajorMinor is correct...
Checking kernelMaxSupportedMajorMinor is correct...
Running phase: autoreconfPhase
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I config
autoreconf: configure.ac: tracing
autoreconf: configure.ac: AM_GNU_GETTEXT is used, but not AM_GNU_GETTEXT_VERSION
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'config'.
libtoolize: copying file 'config/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'config'.
libtoolize: copying file 'config/libtool.m4'
libtoolize: copying file 'config/ltoptions.m4'
libtoolize: copying file 'config/ltsugar.m4'
libtoolize: copying file 'config/ltversion.m4'
libtoolize: copying file 'config/lt~obsolete.m4'
autoreconf: running: /nix/store/jww0dwicdca8yq5f1fr9wavb60i3gshd-autoconf-2.69/bin/autoconf --force
autoreconf: running: /nix/store/jww0dwicdca8yq5f1fr9wavb60i3gshd-autoconf-2.69/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:50: installing 'config/compile'
configure.ac:41: installing 'config/config.guess'
configure.ac:41: installing 'config/config.sub'
configure.ac:44: installing 'config/install-sh'
configure.ac:44: installing 'config/missing'
Makefile.am: installing 'config/depcomp'
autoreconf: Leaving directory `.'
Running phase: updateAutotoolsGnuConfigScriptsPhase
Updating Autotools / GNU config script to a newer upstream version: ./config/config.sub
Updating Autotools / GNU config script to a newer upstream version: ./config/config.guess
Running phase: configurePhase
fixing libtool script ./config/ltmain.sh
./configure
patching script interpreter paths in ./configure
./configure: interpreter directive changed from "#! /bin/sh" to "/nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin/sh"
configure flags: --disable-static --disable-dependency-tracking --prefix=/nix/store/rgzq12knvc834h1y1053a81djdpcpz5f-zfs-kernel-2.3.5-6.12.62 --with-config=kernel --with-tirpc=1 --without-python --with-linux=/nix/store/9v5mkx7zcnjyimhrhprm27k68yxkcsla-linux-6.12.62-dev/lib/modules/6.12.62/source --with-linux-obj=/nix/store/9v5mkx7zcnjyimhrhprm27k68yxkcsla-linux-6.12.62-dev/lib/modules/6.12.62/build KERNEL_CC=/nix/store/kzq78n13l8w24jn8bx4djj79k5j717f1-gcc-14.3.0/bin/gcc KERNEL_LD=/nix/store/dc9vaz50jg7mibk9xvqw5dqv89cxzla3-binutils-2.44/bin/ld KERNEL_AR=/nix/store/vr15iyyykg9zai6fpgvhcgyw7gckl78w-gcc-wrapper-14.3.0/bin/ar KERNEL_NM=/nix/store/vr15iyyykg9zai6fpgvhcgyw7gckl78w-gcc-wrapper-14.3.0/bin/nm KERNEL_STRIP=/nix/store/dc9vaz50jg7mibk9xvqw5dqv89cxzla3-binutils-2.44/bin/strip KERNEL_OBJCOPY=/nix/store/vr15iyyykg9zai6fpgvhcgyw7gckl78w-gcc-wrapper-14.3.0/bin/objcopy KERNEL_OBJDUMP=/nix/store/vr15iyyykg9zai6fpgvhcgyw7gckl78w-gcc-wrapper-14.3.0/bin/objdump KERNEL_READELF=/nix/store/vr15iyyykg9zai6fpgvhcgyw7gckl78w-gcc-wrapper-14.3.0/bin/readelf KERNEL_HOSTCC=/nix/store/vr15iyyykg9zai6fpgvhcgyw7gckl78w-gcc-wrapper-14.3.0/bin/cc KERNEL_HOSTCXX=/nix/store/vr15iyyykg9zai6fpgvhcgyw7gckl78w-gcc-wrapper-14.3.0/bin/c++ KERNEL_HOSTAR=/nix/store/xwydcyvlsa3cvssk0y5llgdhlhjvmqdm-binutils-wrapper-2.44/bin/ar KERNEL_HOSTLD=/nix/store/xwydcyvlsa3cvssk0y5llgdhlhjvmqdm-binutils-wrapper-2.44/bin/ld KERNEL_ARCH=x86_64 KERNEL_CROSS_COMPILE= KERNEL_KCFLAGS+=-march=icelake-client KERNEL_KCFLAGS+=-mtune=icelake-client KERNEL_KBUILD_OUTPUT=/nix/store/9v5mkx7zcnjyimhrhprm27k68yxkcsla-linux-6.12.62-dev/lib/modules/6.12.62/build
configure: error: invalid variable name: `KERNEL_KCFLAGS+'
error: Cannot build '/nix/store/kb9igdg84gkililfbvshivdxlhbh2h8l-zfs-kernel-2.3.5-6.12.62.drv'.
       Reason: builder failed with exit code 1.
       Output paths:
         /nix/store/rgzq12knvc834h1y1053a81djdpcpz5f-zfs-kernel-2.3.5-6.12.62
error: Cannot build '/nix/store/vkakk74cf3cwg74pr7gmdq2crl0idhkg-linux-6.12.62-modules.drv'.
       Reason: 1 dependency failed.
       Output paths:
         /nix/store/1k0ap4a43lpm6kdm3hy22bp9sv4hf597-linux-6.12.62-modules
error: Cannot build '/nix/store/29vanxrwvgf9jvmbk18wcq793gsxa3y3-nixos-system-nixos-26.05pre913595.c6245e83d836.drv'.
       Reason: 1 dependency failed.
       Output paths:
         /nix/store/kw3kywibqj76gk25d3scq88cg6204lyr-nixos-system-nixos-26.05pre913595.c6245e83d836
Command 'nix-build '<nixpkgs/nixos>' --attr config.system.build.toplevel --no-out-link --max-jobs 1' returned non-zero exit status 100.

Additional context

No response

System metadata

  • system: "x86_64-linux"
  • host os: Linux 6.12.62, NixOS, 26.05 (Yarara), 26.05pre913595.c6245e83d836
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.31.2+1
  • nixpkgs: /nix/store/xav32kq6jdxzrk7n8wyhvscny0n8gh05-nixos/nixos

Notify maintainers

@adamcstephens @amarshall


Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Is this issue important to you?

Add a 👍 reaction to issues you find important.

Activity

  1. added
    0.kind: bug
    on Dec 23, 2025
  2. adamcstephens commented on Dec 24, 2025

    @adamcstephens
    Contributor

    This is a problem you’re causing to yourself. If this matters to you then I’d encourage you to open a pull request to fix whatever is necessary, assuming the zfs package even supports these flags. In the meantime I’m closing this as not planned as it is a nonstandard configuration.

  3. n0099 commented on Jul 21, 2026

    @n0099
    Contributor

    Same here with

    {
      extraMakeFlags =
        let
          platform = config.nixpkgs.hostPlatform.gcc;
        in
        lib.concatMap # https://github.com/NixOS/nixpkgs/pull/431961#issuecomment-5035234990
          (
            key:
            lib.optional (platform ? arch) "${key}+=-march=${platform.arch}"
            ++ lib.optional (platform ? tune) "${key}+=-mtune=${platform.tune}"
          )
          [
            "KCFLAGS"
            "KCPPFLAGS"
          ];
    }
    Running phase: unpackPhase
    @nix { "action": "setPhase", "phase": "unpackPhase" }
    unpacking source archive /nix/store/3a86rbglszndkaga4w4ckprgi6jrn7d4-source
    source root is source
    Running phase: patchPhase
    @nix { "action": "setPhase", "phase": "patchPhase" }
    applying patch /nix/store/qw934cj3lf7mp81jka8kmkx26zmfmqdd-6fb72fda0f60d9efb591e320f83f78b19ec451cc.patch?full_index=1
    patching file module/zfs/zio.c
    Hunk #1 succeeded at 3837 (offset 7 lines).
    Hunk #2 succeeded at 3867 (offset 7 lines).
    Hunk #3 succeeded at 3881 (offset 7 lines).
    patching script interpreter paths in scripts
    scripts/commitcheck.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/4qkm0plf1507hcffkbjzywffh42n46hx-bash-5.3p9/bin/sh"
    scripts/zfs-tests.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/4qkm0plf1507hcffkbjzywffh42n46hx-bash-5.3p9/bin/bash"
    scripts/zfs-helpers.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/4qkm0plf1507hcffkbjzywffh42n46hx-bash-5.3p9/bin/sh"
    scripts/spdxcheck.pl: interpreter directive changed from "#!/usr/bin/env perl" to "/nix/store/l9lwq7by1p4bpayh2q6l69s41m0s1rik-perl-5.42.0/bin/perl"
    scripts/paxcheck.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/4qkm0plf1507hcffkbjzywffh42n46hx-bash-5.3p9/bin/sh"
    scripts/mancheck.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/4qkm0plf1507hcffkbjzywffh42n46hx-bash-5.3p9/bin/sh"
    scripts/zloop.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/4qkm0plf1507hcffkbjzywffh42n46hx-bash-5.3p9/bin/bash"
    scripts/zimport.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/4qkm0plf1507hcffkbjzywffh42n46hx-bash-5.3p9/bin/bash"
    scripts/zfs_prepare_disk: interpreter directive changed from "#!/bin/sh" to "/nix/store/4qkm0plf1507hcffkbjzywffh42n46hx-bash-5.3p9/bin/sh"
    scripts/zfs.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/4qkm0plf1507hcffkbjzywffh42n46hx-bash-5.3p9/bin/sh"
    scripts/zfs-tests-color.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/4qkm0plf1507hcffkbjzywffh42n46hx-bash-5.3p9/bin/sh"
    scripts/update_authors.pl: interpreter directive changed from "#!/usr/bin/env perl" to "/nix/store/l9lwq7by1p4bpayh2q6l69s41m0s1rik-perl-5.42.0/bin/perl"
    scripts/man-dates.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/4qkm0plf1507hcffkbjzywffh42n46hx-bash-5.3p9/bin/sh"
    scripts/make_gitrev.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/4qkm0plf1507hcffkbjzywffh42n46hx-bash-5.3p9/bin/sh"
    scripts/kmodtool: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/4qkm0plf1507hcffkbjzywffh42n46hx-bash-5.3p9/bin/bash"
    scripts/dkms.postbuild: interpreter directive changed from "#!/bin/sh" to "/nix/store/4qkm0plf1507hcffkbjzywffh42n46hx-bash-5.3p9/bin/sh"
    scripts/dkms.mkconf: interpreter directive changed from "#!/bin/sh" to "/nix/store/4qkm0plf1507hcffkbjzywffh42n46hx-bash-5.3p9/bin/sh"
    scripts/cstyle.pl: interpreter directive changed from "#!/usr/bin/env perl" to "/nix/store/l9lwq7by1p4bpayh2q6l69s41m0s1rik-perl-5.42.0/bin/perl"
    scripts/convert_wycheproof.pl: interpreter directive changed from "#!/usr/bin/env perl" to "/nix/store/l9lwq7by1p4bpayh2q6l69s41m0s1rik-perl-5.42.0/bin/perl"
    Supported Kernel versions:
    Linux-Maximum: 7.0
    Linux-Minimum: 4.18
    Checking kernelMinSupportedMajorMinor is correct...
    Checking kernelMaxSupportedMajorMinor is correct...
    Running phase: autoreconfPhase
    @nix { "action": "setPhase", "phase": "autoreconfPhase" }
    autoreconf: Entering directory `.'
    autoreconf: configure.ac: not using Gettext
    autoreconf: running: aclocal --force -I config
    autoreconf: configure.ac: tracing
    autoreconf: configure.ac: AM_GNU_GETTEXT is used, but not AM_GNU_GETTEXT_VERSION
    autoreconf: running: libtoolize --copy --force
    libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'config'.
    libtoolize: copying file 'config/ltmain.sh'
    libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'config'.
    libtoolize: copying file 'config/libtool.m4'
    libtoolize: copying file 'config/ltoptions.m4'
    libtoolize: copying file 'config/ltsugar.m4'
    libtoolize: copying file 'config/ltversion.m4'
    libtoolize: copying file 'config/lt~obsolete.m4'
    autoreconf: running: /nix/store/v4d1v3pcxbmbbvvhdb41h3c44wzf27wl-autoconf-2.69/bin/autoconf --force
    autoreconf: running: /nix/store/v4d1v3pcxbmbbvvhdb41h3c44wzf27wl-autoconf-2.69/bin/autoheader --force
    autoreconf: running: automake --add-missing --copy --force-missing
    configure.ac:50: installing 'config/compile'
    configure.ac:41: installing 'config/config.guess'
    configure.ac:41: installing 'config/config.sub'
    configure.ac:44: installing 'config/install-sh'
    configure.ac:44: installing 'config/missing'
    Makefile.am: installing 'config/depcomp'
    autoreconf: Leaving directory `.'
    Running phase: updateAutotoolsGnuConfigScriptsPhase
    @nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
    Updating Autotools / GNU config script to a newer upstream version: ./config/config.sub
    Updating Autotools / GNU config script to a newer upstream version: ./config/config.guess
    Running phase: configurePhase
    @nix { "action": "setPhase", "phase": "configurePhase" }
    fixing libtool script ./config/ltmain.sh
    ./configure
    patching script interpreter paths in ./configure
    ./configure: interpreter directive changed from "#! /bin/sh" to "/nix/store/4qkm0plf1507hcffkbjzywffh42n46hx-bash-5.3p9/bin/sh"
    configure flags: --disable-static --disable-dependency-tracking --prefix=/nix/store/nh96h60gb28c0vzi4270jjis1njdmwwb-zfs-kernel-2.4.3-6.18.38 --with-config=kernel --with-tirpc=1 --without-python --with-linux=/nix/store/i2qcdh0jrfnm169nb1m8d5kpj1plqbjw-linux-cachyos-lts-lto-6.18.38-dev/lib/modules/6.18.38-cachyos-lto/source --with-linux-obj=/nix/store/i2qcdh0jrfnm169nb1m8d5kpj1plqbjw-linux-cachyos-lts-lto-6.18.38-dev/lib/modules/6.18.38-cachyos-lto/build KERNEL_CC=/nix/store/1iwljc1hzw03n7iqsvwfgkddb7fjidrd-clang-21.1.8/bin/clang KERNEL_LD=/nix/store/9593zkpcj1fm3hvrzadk8qpdzbzh3hg5-binutils-2.46/bin/ld KERNEL_AR=/nix/store/isdfmkzcgi3qbi0c1wd5milyh5jydsk5-clang-wrapper-21.1.8/bin/ar KERNEL_NM=/nix/store/isdfmkzcgi3qbi0c1wd5milyh5jydsk5-clang-wrapper-21.1.8/bin/nm KERNEL_STRIP=/nix/store/9593zkpcj1fm3hvrzadk8qpdzbzh3hg5-binutils-2.46/bin/strip KERNEL_OBJCOPY=/nix/store/isdfmkzcgi3qbi0c1wd5milyh5jydsk5-clang-wrapper-21.1.8/bin/objcopy KERNEL_OBJDUMP=/nix/store/isdfmkzcgi3qbi0c1wd5milyh5jydsk5-clang-wrapper-21.1.8/bin/objdump KERNEL_READELF=/nix/store/isdfmkzcgi3qbi0c1wd5milyh5jydsk5-clang-wrapper-21.1.8/bin/readelf KERNEL_HOSTCC=/nix/store/29qjlshvklnyr67nhpprzgb9igmsfsjj-gcc-wrapper-15.2.0/bin/cc KERNEL_HOSTCXX=/nix/store/29qjlshvklnyr67nhpprzgb9igmsfsjj-gcc-wrapper-15.2.0/bin/c++ KERNEL_HOSTAR=/nix/store/zjraf40s86y3iwhp626b934r5y6ldkbb-binutils-wrapper-2.46/bin/ar KERNEL_HOSTLD=/nix/store/zjraf40s86y3iwhp626b934r5y6ldkbb-binutils-wrapper-2.46/bin/ld KERNEL_ARCH=x86_64 KERNEL_CROSS_COMPILE= KERNEL_CFLAGS_MODULE=-I/nix/store/77jlznmkkvvcd0mi3skhpxk19ngq3h1m-clang-21.1.8-lib/lib/clang/21/include KERNEL_CFLAGS_KERNEL=-I/nix/store/77jlznmkkvvcd0mi3skhpxk19ngq3h1m-clang-21.1.8-lib/lib/clang/21/include KERNEL_LLVM=1 KERNEL_LLVM_IAS=1 KERNEL_CC=/nix/store/m0qfz76na8kk7lbrsp7x6lbnr1rjz8k0-clang-wrapper-21.1.8/bin/clang KERNEL_LD=/nix/store/gxyl0ivb8apfr7mi94w87f2vg1wi6b12-lld-21.1.8/bin/ld.lld KERNEL_HOSTLD=/nix/store/gxyl0ivb8apfr7mi94w87f2vg1wi6b12-lld-21.1.8/bin/ld.lld KERNEL_AR=/nix/store/bww222zqg16cvmskgbwqyailj1si6bd3-llvm-21.1.8/bin/llvm-ar KERNEL_HOSTAR=/nix/store/bww222zqg16cvmskgbwqyailj1si6bd3-llvm-21.1.8/bin/llvm-ar KERNEL_NM=/nix/store/bww222zqg16cvmskgbwqyailj1si6bd3-llvm-21.1.8/bin/llvm-nm KERNEL_STRIP=/nix/store/bww222zqg16cvmskgbwqyailj1si6bd3-llvm-21.1.8/bin/llvm-strip KERNEL_OBJCOPY=/nix/store/bww222zqg16cvmskgbwqyailj1si6bd3-llvm-21.1.8/bin/llvm-objcopy KERNEL_OBJDUMP=/nix/store/bww222zqg16cvmskgbwqyailj1si6bd3-llvm-21.1.8/bin/llvm-objdump KERNEL_READELF=/nix/store/bww222zqg16cvmskgbwqyailj1si6bd3-llvm-21.1.8/bin/llvm-readelf KERNEL_HOSTCC=/nix/store/m0qfz76na8kk7lbrsp7x6lbnr1rjz8k0-clang-wrapper-21.1.8/bin/clang KERNEL_HOSTCXX=/nix/store/m0qfz76na8kk7lbrsp7x6lbnr1rjz8k0-clang-wrapper-21.1.8/bin/clang++ KERNEL_NIX_CC_WRAPPER_SUPPRESS_TARGET_WARNING=1 KERNEL_KCFLAGS+=-march=skylake KERNEL_KCFLAGS+=-mtune=skylake KERNEL_KCPPFLAGS+=-march=skylake KERNEL_KCPPFLAGS+=-mtune=skylake KERNEL_KBUILD_OUTPUT=/nix/store/i2qcdh0jrfnm169nb1m8d5kpj1plqbjw-linux-cachyos-lts-lto-6.18.38-dev/lib/modules/6.18.38-cachyos-lto/build
    configure: error: invalid variable name: `KERNEL_KCFLAGS+'
    
  4. n0099 commented on Jul 21, 2026

    @n0099
    Contributor

    Some traceback:

    ++ map (f: "KERNEL_${f}") kernelModuleMakeFlags

    kernelModuleMakeFlags = self.kernel.commonMakeFlags ++ [
    "KBUILD_OUTPUT=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
    ];

    commonMakeFlags = import ./common-flags.nix {
    inherit
    lib
    stdenv
    buildPackages
    extraMakeFlags
    ;
    };


    Searching kernelModuleMakeFlags configure seems only zfs is passing them to configure which is introduced in #435553
    This issue should reopen.

  5. adamcstephens commented on Jul 21, 2026

    @adamcstephens
    Contributor

    Feel free to open a PR with a fix, but this is still considered not planned and thus I won't reopen this issue.

  6. n0099 commented on Jul 21, 2026

    @n0099
    Contributor

    #408433 should fix this by only allowing certain flags to be passed.

  7. n0099 commented on Jul 21, 2026

    @n0099
    Contributor

    hotfix:

    boot.zfs.modulePackage = # https://github.com/NixOS/nixpkgs/issues/473637#issuecomment-5037550911
      config.boot.kernelPackages.${config.boot.zfs.package.kernelModuleAttribute}.overrideAttrs # https://github.com/NixOS/nixpkgs/blob/fd1462031fdee08f65fd0b4c6b64e22239a77870/nixos/modules/tasks/filesystems/zfs.nix#L22
        (prev: {
          configureFlags = lib.filter (i: !(lib.hasInfix "+=" i)) prev.configureFlags;
        });
  8. n0099 commented on Sep 1, 2026

    @n0099
    Contributor

    This one use kernelPackagesExtensions like pythonPackagesExtensions so configureFlags of both config.boot.zfs.modulePackage and config.boot.kernelPackages.${config.boot.zfs.package.kernelModuleAttribute} are changed:

    nixpkgs.overlays = lib.mkIf (extraMakeFlags != [ ]) [
      (_: prev: {
        kernelPackagesExtensions = prev.kernelPackagesExtensions ++ [
          # https://github.com/NixOS/nixpkgs/blob/5dfba6236110080a54247d6460bc2ff5dda939cc/pkgs/top-level/linux-kernels.nix#L668
          (
            _: prev:
            let
              pkgName = config.boot.zfs.package.kernelModuleAttribute; # https://github.com/NixOS/nixpkgs/blob/fd1462031fdee08f65fd0b4c6b64e22239a77870/nixos/modules/tasks/filesystems/zfs.nix#L22
            in
            {
              ${pkgName} = prev.${pkgName}.overrideAttrs (prev: {
                configureFlags = lib.filter (i: !(lib.hasInfix "+=" i)) prev.configureFlags;
              });
            }
          )
        ];
      })
    ];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions