summary refs log tree commit diff
path: root/nixos/modules/system/activation/top-level.nix
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2022-01-24 12:49:58 +0100
committerRobert Hensing <robert@roberthensing.nl>2022-01-24 16:17:19 +0100
commit511e89f5a66c77c378d30853e5e0ac6995e0013e (patch)
treef0325899a59e2c374524f552e297872b8daf874b /nixos/modules/system/activation/top-level.nix
parent2aa7c25808847847bc40be93b57a1e6174aeda09 (diff)
downloadnixpkgs-511e89f5a66c77c378d30853e5e0ac6995e0013e.tar
nixpkgs-511e89f5a66c77c378d30853e5e0ac6995e0013e.tar.gz
nixpkgs-511e89f5a66c77c378d30853e5e0ac6995e0013e.tar.bz2
nixpkgs-511e89f5a66c77c378d30853e5e0ac6995e0013e.tar.lz
nixpkgs-511e89f5a66c77c378d30853e5e0ac6995e0013e.tar.xz
nixpkgs-511e89f5a66c77c378d30853e5e0ac6995e0013e.tar.zst
nixpkgs-511e89f5a66c77c378d30853e5e0ac6995e0013e.zip
nixos: Make system.build.installBootLoader a proper option
This improves the error message when the configuration contains
more than one boot loader.
Diffstat (limited to 'nixos/modules/system/activation/top-level.nix')
-rw-r--r--nixos/modules/system/activation/top-level.nix21
1 files changed, 18 insertions, 3 deletions
diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix
index da8ff8ef145..b1e0274cff1 100644
--- a/nixos/modules/system/activation/top-level.nix
+++ b/nixos/modules/system/activation/top-level.nix
@@ -109,9 +109,7 @@ let
     utillinux = pkgs.util-linux;
 
     kernelParams = config.boot.kernelParams;
-    installBootLoader =
-      config.system.build.installBootLoader
-      or "echo 'Warning: do not know how to make this configuration bootable; please enable a boot loader.' 1>&2; true";
+    installBootLoader = config.system.build.installBootLoader;
     activationScript = config.system.activationScripts.script;
     dryActivationScript = config.system.dryActivationScript;
     nixosLabel = config.system.nixos.label;
@@ -227,6 +225,23 @@ in
     };
 
     system.build = tmpFixupSubmoduleBoundary {
+      installBootLoader = mkOption {
+        internal = true;
+        default = "echo 'Warning: do not know how to make this configuration bootable; please enable a boot loader.' 1>&2; true";
+        description = ''
+          A program that writes a bootloader installation script to the path passed in the first command line argument.
+
+          See <literal>nixos/modules/system/activation/switch-to-configuration.pl</literal>.
+        '';
+        type = types.unique {
+          message = ''
+            Only one bootloader can be enabled at a time. This requirement has not
+            been checked until NixOS 22.05. Earlier versions defaulted to the last
+            definition. Change your configuration to enable only one bootloader.
+          '';
+        } (types.either types.str types.package);
+      };
+
       toplevel = mkOption {
         type = types.package;
         readOnly = true;