Configuration is now held by the `.org` files. All `.nix` files are tangled from the org-mode files.
2.0 KiB
Bootloaders and Filesystems
Bootloaders and Filesystems
This page sets up the bootloader of my machines. Whilst I generally
prefer to use systemd-boot, some of my VPS use GRUB, and some use ZFS.
All that gets exposed with my module nixos.loader.
{
flake.modules.nixos.loader = {
lib,
config,
...
}:
with lib; let
cfg = config.mySystem.boot;
in {
};
}
Bootloaders
By default, I want to use systemd-boot on my machines, but I need it to be disabled whenever I use something else. For now, this “something else” is only GRUB, but I’m not excluding using something else on yet another machine such as rEFInd. To ensure a single source of truth regarding whether systemd-boot is to be used, I have an option for that.
options.mySystem.boot.systemd-boot = mkOption {
type = types.bool;
default = !cfg.grub.enable;
description = "Does the system use systemd-boot?";
};
I can now set some options depending on that, such as whether to enable systemd-boot itself (duh), and whether the installation process can touch my EFI variables.
config.boot.loader = {
systemd-boot.enable = cfg.systemd-boot;
efi.canTouchEfiVariables = cfg.systemd-boot;
};
But, I have a VPS that requires me to use GRUB. For this, I also have an option to enable it.
options.mySystem.boot.grub = {
enable = mkEnableOption "Does the system use GRUB? (Disables systemd-boot)";
device = mkOption {
type = types.path;
description = "The GRUB device";
default = "";
};
};
I can no pass these options to the boot configuration of my machine.
config.boot.loader.grub = mkIf cfg.grub.enable {
inherit (cfg.grub) enable device;
};
ZFS
Now, this is where I enable