mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-06 01:38:06 +00:00
[Boot] allow remove kernel parameters by setting them to null
This commit is contained in:
parent
d38185f994
commit
183a38ec0b
1 changed files with 10 additions and 4 deletions
14
boot.nix
14
boot.nix
|
|
@ -92,7 +92,9 @@ let
|
||||||
|
|
||||||
toCmdlineList = set: mapAttrsToList
|
toCmdlineList = set: mapAttrsToList
|
||||||
(key: value:
|
(key: value:
|
||||||
if (value == "") then
|
if (isNull value) then
|
||||||
|
null
|
||||||
|
else if (value == "") then
|
||||||
"${key}"
|
"${key}"
|
||||||
else
|
else
|
||||||
"${key}=${toCmdlineValue value}"
|
"${key}=${toCmdlineValue value}"
|
||||||
|
|
@ -156,10 +158,14 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
cmdline = mkOption {
|
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 = { };
|
default = { };
|
||||||
example = { "i915.fastboot" = true; };
|
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 = {
|
kernel = {
|
||||||
|
|
@ -204,7 +210,7 @@ in {
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.kernelParams = toCmdlineList cfg.cmdline;
|
boot.kernelParams = filter (v: ! (isNull v)) (toCmdlineList cfg.cmdline);
|
||||||
}
|
}
|
||||||
(mkIf cfg.enable {
|
(mkIf cfg.enable {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue