From 09e80b0b768fe937ace0e58b2c97caa47a697a30 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sun, 26 Oct 2025 13:35:20 +0100 Subject: [PATCH] linux/build: re-expose `config` with its helper functions In #448835 I renamed `config` to `configHelpers` to save a `config_ = config;`, however `config` having the `is*` helpers is kinda public API (as proven by NixOS modules failing to evaluate). As a result, this commit adds the helpers back to `config` that is exposed by the kernel derivation. Apologies, I'm pretty sure I fixed that before locally and it just got lost during a rebase :( --- pkgs/os-specific/linux/kernel/build.nix | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/pkgs/os-specific/linux/kernel/build.nix b/pkgs/os-specific/linux/kernel/build.nix index 0839eaa9fdd9..da50861fb459 100644 --- a/pkgs/os-specific/linux/kernel/build.nix +++ b/pkgs/os-specific/linux/kernel/build.nix @@ -90,6 +90,8 @@ lib.makeOverridable ( # 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; + + config_ = config; in let # Shadow the un-defaulted parameter; don't want null. @@ -139,29 +141,29 @@ lib.makeOverridable ( ]; needsUbootTools = lib.elem stdenv.hostPlatform.linuxArch linuxPlatformsUsingUImage; - configHelpers = + config = let attrName = attr: "CONFIG_" + attr; in { isSet = attr: hasAttr (attrName attr) config; - getValue = attr: if configHelpers.isSet attr then getAttr (attrName attr) config else null; + getValue = attr: if config.isSet attr then getAttr (attrName attr) config else null; - isYes = attr: (configHelpers.getValue attr) == "y"; + isYes = attr: (config.getValue attr) == "y"; - isNo = attr: (configHelpers.getValue attr) == "n"; + isNo = attr: (config.getValue attr) == "n"; - isModule = attr: (configHelpers.getValue attr) == "m"; + isModule = attr: (config.getValue attr) == "m"; - isEnabled = attr: (configHelpers.isModule attr) || (configHelpers.isYes attr); + isEnabled = attr: (config.isModule attr) || (config.isYes attr); - isDisabled = attr: (!(configHelpers.isSet attr)) || (configHelpers.isNo attr); + isDisabled = attr: (!(config.isSet attr)) || (config.isNo attr); } - // config; + // config_; - isModular = configHelpers.isYes "MODULES"; - withRust = configHelpers.isYes "RUST"; + isModular = config.isYes "MODULES"; + withRust = config.isYes "RUST"; target = stdenv.hostPlatform.linux-kernel.target or "vmlinux";