From a868222d6504e0af76fc98716a679f19651ec920 Mon Sep 17 00:00:00 2001 From: Vladimir Serov Date: Sun, 15 Aug 2021 10:33:30 +0300 Subject: [PATCH] nixos.system.boot.kernel: stronger constraints for kernelParam type Checks whether all spaces are inside double quotes, thus ensuring that one string parses as no more than one kernel param. Co-authored-by: pennae <82953136+pennae@users.noreply.github.com> --- nixos/modules/system/boot/kernel.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nixos/modules/system/boot/kernel.nix b/nixos/modules/system/boot/kernel.nix index 46f2e3fec04c..4a9da9394519 100644 --- a/nixos/modules/system/boot/kernel.nix +++ b/nixos/modules/system/boot/kernel.nix @@ -83,7 +83,10 @@ in }; boot.kernelParams = mkOption { - type = types.listOf types.str; + type = types.listOf (types.strMatching ''([^"[:space:]]|"[^"]*")+'' // { + name = "kernelParam"; + description = "string, with spaces inside double quotes"; + }); default = [ ]; description = "Parameters added to the kernel command line."; };