summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorParnell Springmeyer <parnell@digitalmentat.com>2017-01-26 02:00:04 -0800
committerParnell Springmeyer <parnell@digitalmentat.com>2017-01-26 02:00:04 -0800
commita26a796d5c7fa305e007c2b5229e0521c8b3fb0f (patch)
tree6c35defae305b0da581f757b72b461a8f6052620 /nixos/modules/system
parentad8fde5e5d9bc25a54ac238f485e28b37d6d185a (diff)
parent142696de884213e01cc518af813a20d2e2ece3cc (diff)
downloadnixlib-a26a796d5c7fa305e007c2b5229e0521c8b3fb0f.tar
nixlib-a26a796d5c7fa305e007c2b5229e0521c8b3fb0f.tar.gz
nixlib-a26a796d5c7fa305e007c2b5229e0521c8b3fb0f.tar.bz2
nixlib-a26a796d5c7fa305e007c2b5229e0521c8b3fb0f.tar.lz
nixlib-a26a796d5c7fa305e007c2b5229e0521c8b3fb0f.tar.xz
nixlib-a26a796d5c7fa305e007c2b5229e0521c8b3fb0f.tar.zst
nixlib-a26a796d5c7fa305e007c2b5229e0521c8b3fb0f.zip
Merging against master - updating smokingpig, rebase was going to be messy
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py2
-rw-r--r--nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix16
2 files changed, 18 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py
index 515136c904c5..b91d64bb0a7f 100644
--- a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py
+++ b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py
@@ -28,6 +28,8 @@ def write_loader_conf(generation):
         if "@timeout@" != "":
             f.write("timeout @timeout@\n")
         f.write("default nixos-generation-%d\n" % generation)
+        if not @editor@:
+            f.write("editor 0");
     os.rename("@efiSysMountPoint@/loader/loader.conf.tmp", "@efiSysMountPoint@/loader/loader.conf")
 
 def copy_from_profile(generation, name, dry_run=False):
diff --git a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix
index cc43fb8bab4c..ec02f73cada2 100644
--- a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix
+++ b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix
@@ -20,6 +20,8 @@ let
 
     timeout = if config.boot.loader.timeout != null then config.boot.loader.timeout else "";
 
+    editor = if cfg.editor then "True" else "False";
+
     inherit (efi) efiSysMountPoint canTouchEfiVariables;
   };
 in {
@@ -36,6 +38,20 @@ in {
 
       description = "Whether to enable the systemd-boot (formerly gummiboot) EFI boot manager";
     };
+
+    editor = mkOption {
+      default = true;
+
+      type = types.bool;
+
+      description = ''
+        Whether to allow editing the kernel command-line before
+        boot. It is recommended to set this to false, as it allows
+        gaining root access by passing init=/bin/sh as a kernel
+        parameter. However, it is enabled by default for backwards
+        compatibility.
+      '';
+    };
   };
 
   config = mkIf cfg.enable {