feat(boot): configure systemd-boot and GRUB based on options

This commit is contained in:
tux
2026-05-10 04:54:52 +05:30
parent bd6055cae5
commit cb3389bce6
2 changed files with 34 additions and 8 deletions

View File

@@ -1,8 +1,29 @@
{
flake.modules.nixos.boot = {
boot.loader = {
timeout = 1;
efi.canTouchEfiVariables = true;
flake.modules.nixos.boot =
{ config, lib, ... }:
let
cfg = config.tnix.boot;
in
{
options.tnix.boot.legacy = {
enable = lib.mkEnableOption "legacy boot (GRUB) instead of systemd-boot";
};
config = lib.mkMerge [
{
boot.loader = {
timeout = 1;
efi.canTouchEfiVariables = true;
};
}
(lib.mkIf (!cfg.legacy.enable && !cfg.secure-boot.enable) {
boot.loader.systemd-boot.enable = true;
})
(lib.mkIf cfg.legacy.enable {
boot.loader.grub.enable = true;
})
];
};
};
}