From 183a38ec0ba60364cd6d08f2195c0db1965f8397 Mon Sep 17 00:00:00 2001 From: Antoine Viallon Date: Wed, 30 Apr 2025 17:03:51 +0200 Subject: [PATCH] [Boot] allow remove kernel parameters by setting them to null --- boot.nix | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/boot.nix b/boot.nix index fe61058..55573fe 100644 --- a/boot.nix +++ b/boot.nix @@ -92,7 +92,9 @@ let toCmdlineList = set: mapAttrsToList (key: value: - if (value == "") then + if (isNull value) then + null + else if (value == "") then "${key}" else "${key}=${toCmdlineValue value}" @@ -156,10 +158,14 @@ in { }; cmdline = mkOption { - description = "Kernel params as attributes (instead of list)"; + description = "Kernel params as attributes (instead of list). Set a parameter to `null` to remove it."; default = { }; example = { "i915.fastboot" = true; }; - type = with types; attrsOf (oneOf [ bool int str (listOf str) ]); + type = with types; lazyAttrsOf ( + nullOr ( + oneOf [ bool int str (listOf str) ] + ) + ); }; kernel = { @@ -204,7 +210,7 @@ in { } ]; - boot.kernelParams = toCmdlineList cfg.cmdline; + boot.kernelParams = filter (v: ! (isNull v)) (toCmdlineList cfg.cmdline); } (mkIf cfg.enable {