forked from fediversity/fediversity
allow configuring whether a node uses QEMU
This commit is contained in:
parent
3f1c8a9bb7
commit
9f04edc071
2 changed files with 79 additions and 49 deletions
|
|
@ -1,27 +1,47 @@
|
||||||
{ modulesPath, ... }:
|
{ config, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (lib) mkIf mkMerge;
|
||||||
|
|
||||||
|
in
|
||||||
{
|
{
|
||||||
_class = "nixos";
|
_class = "nixos";
|
||||||
|
|
||||||
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
|
config = mkMerge [
|
||||||
|
{
|
||||||
boot = {
|
boot.loader = {
|
||||||
loader = {
|
|
||||||
systemd-boot.enable = true;
|
systemd-boot.enable = true;
|
||||||
efi.canTouchEfiVariables = true;
|
efi.canTouchEfiVariables = true;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
initrd = {
|
(mkIf config.fediversityVm.isQemuVm {
|
||||||
|
|
||||||
|
boot.initrd = {
|
||||||
availableKernelModules = [
|
availableKernelModules = [
|
||||||
"ata_piix"
|
"ata_piix"
|
||||||
"uhci_hcd"
|
"uhci_hcd"
|
||||||
"virtio_pci"
|
|
||||||
"virtio_scsi"
|
|
||||||
"sd_mod"
|
"sd_mod"
|
||||||
"sr_mod"
|
"sr_mod"
|
||||||
|
|
||||||
|
# from `/profiles/qemu-guest.nix`
|
||||||
|
"virtio_net"
|
||||||
|
"virtio_pci"
|
||||||
|
"virtio_mmio"
|
||||||
|
"virtio_blk"
|
||||||
|
"virtio_scsi"
|
||||||
|
"9p"
|
||||||
|
"9pnet_virtio"
|
||||||
|
];
|
||||||
|
kernelModules = [
|
||||||
|
"dm-snapshot"
|
||||||
|
|
||||||
|
# from `/profiles/qemu-guest.nix`
|
||||||
|
"virtio_balloon"
|
||||||
|
"virtio_console"
|
||||||
|
"virtio_rng"
|
||||||
|
"virtio_gpu"
|
||||||
];
|
];
|
||||||
kernelModules = [ "dm-snapshot" ];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
disko.devices.disk.main = {
|
disko.devices.disk.main = {
|
||||||
|
|
@ -61,4 +81,6 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -155,5 +155,13 @@ in
|
||||||
this for testing machines, as it is a security hole for so many reasons.
|
this for testing machines, as it is a security hole for so many reasons.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
isQemuVm = mkOption {
|
||||||
|
description = ''
|
||||||
|
Whether the machine is a QEMU VM. This will import all the necessary
|
||||||
|
things.
|
||||||
|
'';
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue