Commit 3e83fe9a authored by Robert Hensing's avatar Robert Hensing
Browse files

kernel: Make lazier (fix infinite recursion)

parent 74dbae89
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -213,11 +213,15 @@ let
  }; # end of configfile derivation

  kernel = (callPackage ./manual-config.nix { inherit lib stdenv buildPackages; }) (basicArgs // {
    inherit kernelPatches randstructSeed extraMakeFlags extraMeta configfile;
    inherit kernelPatches randstructSeed extraMakeFlags extraMeta configfile modDirVersion;
    pos = builtins.unsafeGetAttrPos "version" args;

    config = { CONFIG_MODULES = "y"; CONFIG_FW_LOADER = "m"; } // lib.optionalAttrs withRust { CONFIG_RUST = "y"; };
  } // lib.optionalAttrs (modDirVersion != null) { inherit modDirVersion; });
    config = {
      CONFIG_MODULES = "y";
      CONFIG_FW_LOADER = "m";
      CONFIG_RUST = lib.mkIf withRust "y";
    };
  });

in
kernel.overrideAttrs (finalAttrs: previousAttrs: {
+8 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ in lib.makeOverridable ({
  extraMakeFlags ? [],
  # The name of the kernel module directory
  # Needs to be X.Y.Z[-extra], so pad with zeros if needed.
  modDirVersion ? lib.versions.pad 3 version,
  modDirVersion ? null /* derive from version */,
  # The kernel source (tarball, git checkout, etc.)
  src,
  # a list of { name=..., patch=..., extraConfig=...} patches
@@ -54,6 +54,13 @@ in lib.makeOverridable ({
}:

let
  # Provide defaults. Note that we support `null` so that callers don't need to use optionalAttrs,
  # which can lead to unnecessary strictness and infinite recursions.
  modDirVersion_ = if modDirVersion == null then lib.versions.pad 3 version else modDirVersion;
in
let
  # Shadow the un-defaulted parameter; don't want null.
  modDirVersion = modDirVersion_;
  inherit (lib)
    hasAttr getAttr optional optionals optionalString optionalAttrs maintainers platforms;