Move defaults/base-vm to nixos-modules/system/virtual-machine.nix

This commit is contained in:
Fabian Hauser 2025-03-21 19:58:29 +02:00
parent 94510a8cd9
commit 24b4b04df9
7 changed files with 66 additions and 42 deletions

View file

@ -1,38 +0,0 @@
{
config,
lib,
modulesPath,
pkgs,
...
}:
{
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
];
boot.loader.grub.enable = true;
system.autoUpgrade.allowReboot = true;
services.qemuGuest.enable = true;
boot.initrd.availableKernelModules = [
"ahci"
"xhci_pci"
"sr_mod"
];
# Taken from https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/profiles/minimal.nix
documentation.enable = lib.mkDefault false;
documentation.doc.enable = lib.mkDefault false;
documentation.info.enable = lib.mkDefault false;
documentation.man.enable = lib.mkDefault false;
documentation.nixos.enable = lib.mkDefault false;
}

View file

@ -2,7 +2,6 @@
{
imports = [
../../defaults/base-vm
../../defaults/meta
./applications
@ -10,6 +9,7 @@
./networking.nix
./secrets.nix
];
qois.system.virtual-machine.enable = true;
# Set your time zone.
time.timeZone = "Europe/Amsterdam";

View file

@ -2,13 +2,14 @@
{
imports = [
../../defaults/base-vm
../../defaults/meta
./applications
./backup.nix
./secrets.nix
];
qois.system.virtual-machine.enable = true;
boot.loader.grub.device = "/dev/vda";
fileSystems."/" = {
device = "/dev/disk/by-uuid/5b6823ec-921f-400a-a7c0-3fe34d56ae12";

View file

@ -2,7 +2,6 @@
{
imports = [
../../defaults/base-vm
../../defaults/meta
./applications
@ -11,6 +10,8 @@
./secrets.nix
];
qois.system.virtual-machine.enable = true;
# Set your time zone.
time.timeZone = "Europe/Amsterdam";

View file

@ -11,6 +11,7 @@ let
in
with lib;
{
options.qois.cloud = {
enable = mkEnableOption "Enable qois cloud service";

View file

@ -7,10 +7,11 @@
}:
{
imports = [
./unfree.nix
./applications.nix
./overlays.nix
./security.nix
./unfree.nix
./virtual-machine.nix
];
boot.loader.timeout = 2;

View file

@ -0,0 +1,58 @@
{
config,
lib,
...
}:
let
cfg = config.qois.system.virtual-machine;
in
with lib;
{
options.qois.system.virtual-machine.enable =
mkEnableOption "Enable qois system vm default configuration";
config = lib.mkIf cfg.enable {
boot.loader.grub.enable = true;
system.autoUpgrade.allowReboot = true;
services.qemuGuest.enable = true;
boot.initrd.availableKernelModules =
[
"ahci"
"xhci_pci"
"sr_mod"
]
++
# Taken from https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/profiles/qemu-guest.nix
[
"virtio_net"
"virtio_pci"
"virtio_mmio"
"virtio_blk"
"virtio_scsi"
"9p"
"9pnet_virtio"
];
boot.initrd.kernelModules = [
"virtio_balloon"
"virtio_console"
"virtio_rng"
"virtio_gpu"
];
# Taken from https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/profiles/minimal.nix
documentation.enable = lib.mkDefault false;
documentation.doc.enable = lib.mkDefault false;
documentation.info.enable = lib.mkDefault false;
documentation.man.enable = lib.mkDefault false;
documentation.nixos.enable = lib.mkDefault false;
};
}