summary refs log tree commit diff
path: root/nixos/modules/system/boot/stage-1.nix
diff options
context:
space:
mode:
authorrnhmjoj <rnhmjoj@inventati.org>2020-02-14 14:11:33 +0100
committerrnhmjoj <rnhmjoj@inventati.org>2020-02-15 12:13:33 +0100
commitdea79b56f7218ba75653260232c07d2f5ad2f109 (patch)
tree24555f8024e8cafd6a89d2db6a3c24ce4a37a2dc /nixos/modules/system/boot/stage-1.nix
parent3b7f5c6762bb174bd9951a697b636e1db531e98a (diff)
downloadnixpkgs-dea79b56f7218ba75653260232c07d2f5ad2f109.tar
nixpkgs-dea79b56f7218ba75653260232c07d2f5ad2f109.tar.gz
nixpkgs-dea79b56f7218ba75653260232c07d2f5ad2f109.tar.bz2
nixpkgs-dea79b56f7218ba75653260232c07d2f5ad2f109.tar.lz
nixpkgs-dea79b56f7218ba75653260232c07d2f5ad2f109.tar.xz
nixpkgs-dea79b56f7218ba75653260232c07d2f5ad2f109.tar.zst
nixpkgs-dea79b56f7218ba75653260232c07d2f5ad2f109.zip
nixos/boot: add option to disable initrd
Diffstat (limited to 'nixos/modules/system/boot/stage-1.nix')
-rw-r--r--nixos/modules/system/boot/stage-1.nix13
1 files changed, 12 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix
index 4c2d130d5a5..524553bfdaf 100644
--- a/nixos/modules/system/boot/stage-1.nix
+++ b/nixos/modules/system/boot/stage-1.nix
@@ -379,6 +379,17 @@ in
       '';
     };
 
+    boot.initrd.enable = mkOption {
+      type = types.bool;
+      default = !config.boot.isContainer;
+      defaultText = "!config.boot.isContainer";
+      description = ''
+        Whether to enable the NixOS initial RAM disk (initrd). This may be
+        needed to perform some initialisation tasks (like mounting
+        network/encrypted file systems) before continuing the boot process.
+      '';
+    };
+
     boot.initrd.prepend = mkOption {
       default = [ ];
       type = types.listOf types.str;
@@ -544,7 +555,7 @@ in
 
   };
 
-  config = mkIf (!config.boot.isContainer) {
+  config = mkIf config.boot.initrd.enable {
     assertions = [
       { assertion = any (fs: fs.mountPoint == "/") fileSystems;
         message = "The ‘fileSystems’ option does not specify your root file system.";