2021-05-30 13:19:32 +02:00
|
|
|
{ hostName
|
|
|
|
, rootUUID
|
|
|
|
, efiUUID
|
|
|
|
, swapUUID
|
|
|
|
}:
|
2021-05-30 12:51:12 +02:00
|
|
|
{ config, pkgs, lib, modulesPath, ... }@all:
|
2021-05-30 11:19:34 +02:00
|
|
|
with lib;
|
|
|
|
let
|
2021-05-30 13:19:32 +02:00
|
|
|
cfg = config.magic_rb.hardware."${hostName}";
|
2021-05-30 12:51:12 +02:00
|
|
|
qemu-guest = import (modulesPath + "/profiles/qemu-guest.nix") all;
|
2021-05-30 11:19:34 +02:00
|
|
|
in
|
|
|
|
{
|
2021-05-30 13:19:32 +02:00
|
|
|
options.magic_rb.hardware."${hostName}" = mkEnableOption "";
|
2021-05-30 11:19:34 +02:00
|
|
|
|
2021-05-30 12:51:12 +02:00
|
|
|
config = mkIf cfg ({
|
2021-05-30 11:19:34 +02:00
|
|
|
boot = {
|
|
|
|
kernelPackages = pkgs.linuxPackages_latest;
|
|
|
|
loader.grub.extraConfig = ''
|
|
|
|
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
|
|
|
|
terminal_input --append serial
|
|
|
|
terminal_output --append serial
|
|
|
|
'';
|
2021-05-30 12:51:12 +02:00
|
|
|
|
|
|
|
initrd.kernelModules = [
|
|
|
|
"nvme"
|
|
|
|
];
|
2021-05-30 11:19:34 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
swapDevices = [
|
|
|
|
{
|
2021-05-30 13:19:32 +02:00
|
|
|
device = "/dev/disk/by-uuid/${swapUUID}";
|
2021-05-30 11:19:34 +02:00
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
fileSystems = {
|
|
|
|
"/" =
|
|
|
|
{
|
2021-05-30 13:19:32 +02:00
|
|
|
device = "/dev/disk/by-uuid/${rootUUID}";
|
2021-05-30 11:19:34 +02:00
|
|
|
fsType = "xfs";
|
|
|
|
};
|
|
|
|
|
|
|
|
"/boot/efi" =
|
|
|
|
{
|
2021-05-30 13:19:32 +02:00
|
|
|
device = "/dev/disk/by-uuid/${efiUUID}";
|
2021-05-30 12:51:12 +02:00
|
|
|
fsType = "vfat";
|
2021-05-30 11:19:34 +02:00
|
|
|
};
|
|
|
|
};
|
2021-05-30 12:51:12 +02:00
|
|
|
} // qemu-guest);
|
2021-05-30 11:19:34 +02:00
|
|
|
}
|