-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
Description
Describe the bug
There is an oddity with how the kernel derivations react when overrideAttrs is used with them. Some passthru values are lost, namely features and commonStructuredConfig.
In turn, this makes customizing them harder than expected. These values are used in the NixOS modules.
To Reproduce
Using overrideAttrs, the passthru value given to the function does not hold all values found on the derivation's own passthru.
Details:
let
kernel = pkgs.linux_latest;
overriddenKernel = kernel.overrideAttrs({ passthru ? {}, ... }: {
passthru = passthru // {
world = "y'all";
};
});
in
/* ok */ assert kernel ? features;
/* ok */ assert kernel ? commonStructuredConfig;
/* fail */ assert overriddenKernel ? features;
/* fail */ assert overriddenKernel ? commonStructuredConfig;Expected behavior
Values in passthru on the derivation should all be present in the overrideAttrs call.
Workaround
let
kernel = pkgs.linux_latest;
overriddenKernel = kernel.overrideAttrs({ passthru ? {}, ... }: {
passthru = kernel.passthru // { # <- use the derivation rather than the param
world = "y'all";
};
});
inAdditional context
And where I suspect this is coming from:
nixpkgs/pkgs/os-specific/linux/kernel/generic.nix
Lines 179 to 187 in 21a2aeb
passthru = { features = kernelFeatures; inherit commonStructuredConfig isXen isZen isHardened isLibre; kernelOlder = lib.versionOlder version; kernelAtLeast = lib.versionAtLeast version; passthru = kernel.passthru // (removeAttrs passthru [ "passthru" ]); }; in lib.extendDerivation true passthru kernel
This is can be observed against 891f607, and is an evaluation issue. No builds happened.
The linked gist contains a full reproduction.
Maintainer information:
# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module: