about summary refs log tree commit diff
path: root/nixos/modules/system/boot/kernel_config.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/system/boot/kernel_config.nix')
-rw-r--r--nixos/modules/system/boot/kernel_config.nix7
1 files changed, 3 insertions, 4 deletions
diff --git a/nixos/modules/system/boot/kernel_config.nix b/nixos/modules/system/boot/kernel_config.nix
index 31e9ec626ca6..e618070f0dc3 100644
--- a/nixos/modules/system/boot/kernel_config.nix
+++ b/nixos/modules/system/boot/kernel_config.nix
@@ -70,11 +70,10 @@ let
       let
         val = if item.freeform != null then item.freeform else item.tristate;
       in
-        if val == null
-          then ""
-          else if (item.optional)
+        optionalString (val != null)
+            (if (item.optional)
             then "${key}? ${mkValue val}\n"
-            else "${key} ${mkValue val}\n";
+            else "${key} ${mkValue val}\n");
 
     mkConf = cfg: concatStrings (mapAttrsToList mkConfigLine cfg);
   in mkConf exprs;