nix/shared/commons/boot.nix
2025-07-24 20:36:09 +02:00

32 lines
No EOL
821 B
Nix

{ config, lib, modulesPath, ... }:
let
# Import nodes
nodes = import ./../../nodes.nix;
myNode = nodes."${config.hostName}";
hasGrub = nd: lib.hasAttr "grubDevice" nd;
bootLoader = if hasGrub myNode then {
grub.enable = true;
grub.device = myNode.grubDevice;
} else {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
in
{
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
(modulesPath + "/virtualisation/qemu-guest-agent.nix")
];
services.qemuGuest.enable = true;
fileSystems = myNode.fileSystems;
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
boot.loader = bootLoader;
nixpkgs.hostPlatform = lib.mkDefault myNode.system;
}