3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix

63 lines
1.3 KiB
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.boot.loader.systemd-boot;
efi = config.boot.loader.efi;
gummibootBuilder = pkgs.substituteAll {
2016-06-01 11:54:03 +01:00
src = ./systemd-boot-builder.py;
isExecutable = true;
inherit (pkgs) python;
systemd = config.systemd.package;
nix = config.nix.package.out;
timeout = if config.boot.loader.timeout != null then config.boot.loader.timeout else "";
inherit (efi) efiSysMountPoint canTouchEfiVariables;
};
in {
imports =
[ (mkRenamedOptionModule [ "boot" "loader" "gummiboot" "enable" ] [ "boot" "loader" "systemd-boot" "enable" ])
];
options.boot.loader.systemd-boot = {
enable = mkOption {
default = false;
type = types.bool;
description = "Whether to enable the systemd-boot (formerly gummiboot) EFI boot manager";
};
};
config = mkIf cfg.enable {
assertions = [
{
2013-03-03 22:48:33 +00:00
assertion = (config.boot.kernelPackages.kernel.features or { efiBootStub = true; }) ? efiBootStub;
message = "This kernel does not support the EFI boot stub";
}
];
2014-04-30 10:41:39 +01:00
boot.loader.grub.enable = mkDefault false;
system = {
build.installBootLoader = gummibootBuilder;
boot.loader.id = "systemd-boot";
requiredKernelConfig = with config.lib.kernelConfig; [
(isYes "EFI_STUB")
];
};
};
}