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