forked from Fediversity/Fediversity
Allow disabling QEMU VM-specific options
This commit is contained in:
parent
8d2bda17f1
commit
0d8d418a91
2 changed files with 79 additions and 49 deletions
|
@ -1,62 +1,84 @@
|
||||||
{ modulesPath, ... }:
|
{ config, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (lib) mkIf mkMerge;
|
||||||
|
|
||||||
|
in
|
||||||
{
|
{
|
||||||
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
|
config = mkMerge [
|
||||||
|
{
|
||||||
|
boot.loader = {
|
||||||
|
systemd-boot.enable = true;
|
||||||
|
efi.canTouchEfiVariables = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
boot = {
|
(mkIf config.procolixVm.isQemuVm {
|
||||||
loader = {
|
|
||||||
systemd-boot.enable = true;
|
|
||||||
efi.canTouchEfiVariables = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
initrd = {
|
boot.initrd = {
|
||||||
availableKernelModules = [
|
availableKernelModules = [
|
||||||
"ata_piix"
|
"ata_piix"
|
||||||
"uhci_hcd"
|
"uhci_hcd"
|
||||||
"virtio_pci"
|
"sd_mod"
|
||||||
"virtio_scsi"
|
"sr_mod"
|
||||||
"sd_mod"
|
|
||||||
"sr_mod"
|
|
||||||
];
|
|
||||||
kernelModules = [ "dm-snapshot" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
disko.devices.disk.main = {
|
# from `/profiles/qemu-guest.nix`
|
||||||
device = "/dev/sda";
|
"virtio_net"
|
||||||
type = "disk";
|
"virtio_pci"
|
||||||
|
"virtio_mmio"
|
||||||
|
"virtio_blk"
|
||||||
|
"virtio_scsi"
|
||||||
|
"9p"
|
||||||
|
"9pnet_virtio"
|
||||||
|
];
|
||||||
|
kernelModules = [
|
||||||
|
"dm-snapshot"
|
||||||
|
|
||||||
content = {
|
# from `/profiles/qemu-guest.nix`
|
||||||
type = "gpt";
|
"virtio_balloon"
|
||||||
|
"virtio_console"
|
||||||
|
"virtio_rng"
|
||||||
|
"virtio_gpu"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
partitions = {
|
disko.devices.disk.main = {
|
||||||
MBR = {
|
device = "/dev/sda";
|
||||||
priority = 0;
|
type = "disk";
|
||||||
size = "1M";
|
|
||||||
type = "EF02";
|
|
||||||
};
|
|
||||||
|
|
||||||
ESP = {
|
content = {
|
||||||
priority = 1;
|
type = "gpt";
|
||||||
size = "500M";
|
|
||||||
type = "EF00";
|
|
||||||
content = {
|
|
||||||
type = "filesystem";
|
|
||||||
format = "vfat";
|
|
||||||
mountpoint = "/boot";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
root = {
|
partitions = {
|
||||||
priority = 2;
|
MBR = {
|
||||||
size = "100%";
|
priority = 0;
|
||||||
content = {
|
size = "1M";
|
||||||
type = "filesystem";
|
type = "EF02";
|
||||||
format = "ext4";
|
};
|
||||||
mountpoint = "/";
|
|
||||||
|
ESP = {
|
||||||
|
priority = 1;
|
||||||
|
size = "500M";
|
||||||
|
type = "EF00";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
root = {
|
||||||
|
priority = 2;
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "ext4";
|
||||||
|
mountpoint = "/";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
})
|
||||||
};
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,5 +175,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