Files
nixos/modules/nixos/vmdev.nix
T

62 lines
1.2 KiB
Nix
Raw Normal View History

2024-10-19 01:19:59 -05:00
{
pkgs,
lib,
config,
...
}:
2024-07-13 02:37:17 -05:00
let
cfg = config.greg.vmdev;
in
with lib;
2024-07-13 02:37:17 -05:00
{
options = {
greg.vmdev = {
enable = mkEnableOption "Enable this system for VM development work";
user = mkOption {
default = "greg";
type = types.str;
description = "The user who will be doing VM dev";
};
system = mkOption {
default = "amd";
type = types.str;
description = "Kernel module type to install - amd, intel, etc";
};
};
};
2024-07-13 02:37:17 -05:00
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
dmidecode
2024-10-22 10:18:01 -05:00
#guestfs-tools
libguestfs
OVMFFull
2024-11-14 00:23:18 -06:00
nixos-generators
packer
2025-01-08 08:05:24 -06:00
swtpm
virt-manager
2025-01-08 08:05:24 -06:00
virtio-win
xorriso
];
2024-07-13 02:37:17 -05:00
users.users."${cfg.user}".extraGroups = [ "libvirtd" ];
2024-07-13 02:37:17 -05:00
# Enable the virtualisation services
virtualisation = {
libvirtd = {
enable = true;
onBoot = "ignore"; # Do not auto-restart VMs on boot, unless they are marked autostart
2025-01-08 08:05:24 -06:00
qemu = {
swtpm = {
enable = true;
package = pkgs.swtpm;
};
2025-01-07 10:58:24 -06:00
};
};
};
2024-07-13 02:37:17 -05:00
boot.extraModprobeConfig = "options kvm_${cfg.system} nested=1";
};
2024-07-13 02:37:17 -05:00
}