OOKNET                             [ /  search the index  ]  
──────────────────────────────────────────────────────────────────────────────────────
══════════════════════════════════════════════════════════════════════════════════════
OOKNET   [ /  search  ]  
────────────────────────────────────────────────
════════════════════════════════════════════════
 
HASH      1d4a00fec597
DATE      2025-05-06
SUBJECT   refactor: move virtualiazation -> modules/nixos/virtualization
FILES     14 CHANGED
HASH      1d4a00fec597
DATE      2025-05-06
SUBJECT   refactor: move virtualiazation ->
          modules/nixos/virtualization
FILES     14 CHANGED
 

diff --git a/modules/nixos/server/options.nix b/modules/nixos/server/options.nix
index 33c7b26..c10572a 100644
--- a/modules/nixos/server/options.nix
+++ b/modules/nixos/server/options.nix
@@ -9,7 +9,7 @@ in {
       description = "Whether the server will act as a tailscale exit node or not"
;
     };
     profile = mkOption {
-      type = nullOr (enum ["linode"]);
+      type = nullOr (enum ["linode" "ookstest"]);
       default = null;
       description = "The server profile the host will use as a base";
     };

diff --git a/modules/nixos/server/options.ni
x b/modules/nixos/server/options.nix
index 33c7b26..c10572a 100644
--- a/modules/nixos/server/options.nix
+++ b/modules/nixos/server/options.nix
@@ -9,7 +9,7 @@ in {
       description = "Whether the server wil
l act as a tailscale exit node or not";
     };
     profile = mkOption {
-      type = nullOr (enum ["linode"]);
+      type = nullOr (enum ["linode" "ookste
st"]);
       default = null;
       description = "The server profile the
 host will use as a base";
     };
 

diff --git a/modules/nixos/server/profiles/linode/base/boot.nix b/modules/nixos/se
rver/profiles/linode/base/boot.nix
index 491eb39..7d43178 100644
--- a/modules/nixos/server/profiles/linode/base/boot.nix
+++ b/modules/nixos/server/profiles/linode/base/boot.nix
@@ -5,6 +5,7 @@
 }: let
   inherit (lib) mkForce getExe';
 in {
+  ooknet.virtualization.guest.type = "qemu";
   boot = {
     kernelPackages = pkgs.linuxPackages_latest;
     kernelModules = [];
@@ -19,20 +20,6 @@ in {
         "virtio_scsi"
         "ahci"
         "sd_mod"
-
-        # qemu guest modules
-        "virtio_net"
-        "virtio_mmio"
-        "virtio_blk"
-        "virtio_scsi"
-        "9p"
-        "9pnet_virtio"
-      ];
-      kernelModules = [
-        "virtio_balloon"
-        "virtio_console"
-        "virtio_rng"
-        "virtio_gpu"
       ];
     };
     loader = {

diff --git a/modules/nixos/server/profiles/l
inode/base/boot.nix b/modules/nixos/server/p
rofiles/linode/base/boot.nix
index 491eb39..7d43178 100644
--- a/modules/nixos/server/profiles/linode/b
ase/boot.nix
+++ b/modules/nixos/server/profiles/linode/b
ase/boot.nix
@@ -5,6 +5,7 @@
 }: let
   inherit (lib) mkForce getExe';
 in {
+  ooknet.virtualization.guest.type = "qemu"
;
   boot = {
     kernelPackages = pkgs.linuxPackages_lat
est;
     kernelModules = [];
@@ -19,20 +20,6 @@ in {
         "virtio_scsi"
         "ahci"
         "sd_mod"
-
-        # qemu guest modules
-        "virtio_net"
-        "virtio_mmio"
-        "virtio_blk"
-        "virtio_scsi"
-        "9p"
-        "9pnet_virtio"
-      ];
-      kernelModules = [
-        "virtio_balloon"
-        "virtio_console"
-        "virtio_rng"
-        "virtio_gpu"
       ];
     };
     loader = {
 

diff --git a/modules/nixos/server/profiles/ookstest/default.nix b/modules/nixos/se
rver/profiles/ookstest/default.nix
new file mode 100644
index 0000000..7837ffb
--- /dev/null
+++ b/modules/nixos/server/profiles/ookstest/default.nix
@@ -0,0 +1,5 @@
+{
+  imports = [
+    ./qemu.nix
+  ];
+}

diff --git a/modules/nixos/server/profiles/o
okstest/default.nix b/modules/nixos/server/p
rofiles/ookstest/default.nix
new file mode 100644
index 0000000..7837ffb
--- /dev/null
+++ b/modules/nixos/server/profiles/ookstest
/default.nix
@@ -0,0 +1,5 @@
+{
+  imports = [
+    ./qemu.nix
+  ];
+}
 

diff --git a/modules/nixos/server/profiles/ookstest/qemu.nix b/modules/nixos/serve
r/profiles/ookstest/qemu.nix
new file mode 100644
index 0000000..7d30cac
--- /dev/null
+++ b/modules/nixos/server/profiles/ookstest/qemu.nix
@@ -0,0 +1,3 @@
+{
+  ooknet.virtualization.qemu.enable = true;
+}

diff --git a/modules/nixos/server/profiles/o
okstest/qemu.nix b/modules/nixos/server/prof
iles/ookstest/qemu.nix
new file mode 100644
index 0000000..7d30cac
--- /dev/null
+++ b/modules/nixos/server/profiles/ookstest
/qemu.nix
@@ -0,0 +1,3 @@
+{
+  ooknet.virtualization.qemu.enable = true;
+}
 

diff --git a/modules/nixos/virtualization/default.nix b/modules/nixos/virtualizati
on/default.nix
new file mode 100644
index 0000000..d30f37b
--- /dev/null
+++ b/modules/nixos/virtualization/default.nix
@@ -0,0 +1,7 @@
+{
+  imports = [
+    ./options.nix
+    ./host
+    ./guest
+  ];
+}

diff --git a/modules/nixos/virtualization/de
fault.nix b/modules/nixos/virtualization/def
ault.nix
new file mode 100644
index 0000000..d30f37b
--- /dev/null
+++ b/modules/nixos/virtualization/default.n
ix
@@ -0,0 +1,7 @@
+{
+  imports = [
+    ./options.nix
+    ./host
+    ./guest
+  ];
+}
 

diff --git a/modules/nixos/virtualization/guest/default.nix b/modules/nixos/virtua
lization/guest/default.nix
new file mode 100644
index 0000000..2becdf1
--- /dev/null
+++ b/modules/nixos/virtualization/guest/default.nix
@@ -0,0 +1,5 @@
+{
+  imports = [
+    ./qemuGuest.nix
+  ];
+}

diff --git a/modules/nixos/virtualization/gu
est/default.nix b/modules/nixos/virtualizati
on/guest/default.nix
new file mode 100644
index 0000000..2becdf1
--- /dev/null
+++ b/modules/nixos/virtualization/guest/def
ault.nix
@@ -0,0 +1,5 @@
+{
+  imports = [
+    ./qemuGuest.nix
+  ];
+}
 

diff --git a/modules/nixos/virtualization/guest/qemuGuest.nix b/modules/nixos/virt
ualization/guest/qemuGuest.nix
new file mode 100644
index 0000000..5e6fa90
--- /dev/null
+++ b/modules/nixos/virtualization/guest/qemuGuest.nix
@@ -0,0 +1,28 @@
+{
+  lib,
+  config,
+  ...
+}: let
+  inherit (lib) mkIf;
+  inherit (config.ooknet.virtualiazation) guest;
+in {
+  config = mkIf (guest.enable && guest.type == "qemu") {
+    services.qemuGuest.enable = true;
+    boot.initrd = {
+      availableKernelModules = [
+        "virtio_net"
+        "virtio_mmio"
+        "virtio_blk"
+        "virtio_scsi"
+        "9p"
+        "9pnet_virtio"
+      ];
+      kernelModules = [
+        "virtio_balloon"
+        "virtio_console"
+        "virtio_rng"
+        "virtio_gpu"
+      ];
+    };
+  };
+}

diff --git a/modules/nixos/virtualization/gu
est/qemuGuest.nix b/modules/nixos/virtualiza
tion/guest/qemuGuest.nix
new file mode 100644
index 0000000..5e6fa90
--- /dev/null
+++ b/modules/nixos/virtualization/guest/qem
uGuest.nix
@@ -0,0 +1,28 @@
+{
+  lib,
+  config,
+  ...
+}: let
+  inherit (lib) mkIf;
+  inherit (config.ooknet.virtualiazation) g
uest;
+in {
+  config = mkIf (guest.enable && guest.type
 == "qemu") {
+    services.qemuGuest.enable = true;
+    boot.initrd = {
+      availableKernelModules = [
+        "virtio_net"
+        "virtio_mmio"
+        "virtio_blk"
+        "virtio_scsi"
+        "9p"
+        "9pnet_virtio"
+      ];
+      kernelModules = [
+        "virtio_balloon"
+        "virtio_console"
+        "virtio_rng"
+        "virtio_gpu"
+      ];
+    };
+  };
+}
 

diff --git a/modules/nixos/workstation/virtualization/default.nix b/modules/nixos/
virtualization/host/default.nix
similarity index 79%
rename from modules/nixos/workstation/virtualization/default.nix
rename to modules/nixos/virtualization/host/default.nix
index 03eb893..c76e8f9 100644
--- a/modules/nixos/workstation/virtualization/default.nix
+++ b/modules/nixos/virtualization/host/default.nix
@@ -1,5 +1,6 @@
 {
   imports = [
+    ./libvirtd.nix
     ./virt-manager.nix
     ./ooknet-install-vm.nix
   ];

diff --git a/modules/nixos/workstation/virtu
alization/default.nix b/modules/nixos/virtua
lization/host/default.nix
similarity index 79%
rename from modules/nixos/workstation/virtua
lization/default.nix
rename to modules/nixos/virtualization/host/
default.nix
index 03eb893..c76e8f9 100644
--- a/modules/nixos/workstation/virtualizati
on/default.nix
+++ b/modules/nixos/virtualization/host/defa
ult.nix
@@ -1,5 +1,6 @@
 {
   imports = [
+    ./libvirtd.nix
     ./virt-manager.nix
     ./ooknet-install-vm.nix
   ];
 

diff --git a/modules/nixos/workstation/virtualization/virt-manager.nix b/modules/n
ixos/virtualization/host/libvirtd.nix
similarity index 54%
rename from modules/nixos/workstation/virtualization/virt-manager.nix
rename to modules/nixos/virtualization/host/libvirtd.nix
index 4b43c40..f5c6d3a 100644
--- a/modules/nixos/workstation/virtualization/virt-manager.nix
+++ b/modules/nixos/virtualization/host/libvirtd.nix
@@ -1,34 +1,13 @@
 {
-  config,
   lib,
+  config,
   pkgs,
   ...
 }: let
-  inherit (builtins) attrValues;
-  inherit (lib) mkIf elem;
-  inherit (config.ooknet.workstation) profiles;
+  inherit (lib) mkIf;
+  cfg = config.ooknet.virtualization.host;
 in {
-  config = mkIf (elem "virtualization" profiles) {
-    environment.systemPackages = attrValues {
-      inherit
-        (pkgs)
-        virt-viewer
-        qemu_kvm
-        qemu
-        spice
-        spice-protocol
-        # for windows virtualization
-        win-virtio
-        win-spice
-        adwaita-icon-theme # virt-manager needs this
-        remmina # for rdp
-        ;
-    };
-    # sets up dconf settins for qemu and add virt-manager to systemPackages
-    programs.virt-manager = {
-      enable = true;
-      package = pkgs.virt-manager;
-    };
+  config = mkIf cfg.enable {
     virtualisation = {
       # allow unprivileged users to pass usb devices to vm
       spiceUSBRedirection.enable = true;

diff --git a/modules/nixos/workstation/virtu
alization/virt-manager.nix b/modules/nixos/v
irtualization/host/libvirtd.nix
similarity index 54%
rename from modules/nixos/workstation/virtua
lization/virt-manager.nix
rename to modules/nixos/virtualization/host/
libvirtd.nix
index 4b43c40..f5c6d3a 100644
--- a/modules/nixos/workstation/virtualizati
on/virt-manager.nix
+++ b/modules/nixos/virtualization/host/libv
irtd.nix
@@ -1,34 +1,13 @@
 {
-  config,
   lib,
+  config,
   pkgs,
   ...
 }: let
-  inherit (builtins) attrValues;
-  inherit (lib) mkIf elem;
-  inherit (config.ooknet.workstation) profi
les;
+  inherit (lib) mkIf;
+  cfg = config.ooknet.virtualization.host;
 in {
-  config = mkIf (elem "virtualization" prof
iles) {
-    environment.systemPackages = attrValues
 {
-      inherit
-        (pkgs)
-        virt-viewer
-        qemu_kvm
-        qemu
-        spice
-        spice-protocol
-        # for windows virtualization
-        win-virtio
-        win-spice
-        adwaita-icon-theme # virt-manager n
eeds this
-        remmina # for rdp
-        ;
-    };
-    # sets up dconf settins for qemu and ad
d virt-manager to systemPackages
-    programs.virt-manager = {
-      enable = true;
-      package = pkgs.virt-manager;
-    };
+  config = mkIf cfg.enable {
     virtualisation = {
       # allow unprivileged users to pass us
b devices to vm
       spiceUSBRedirection.enable = true;
 

diff --git a/modules/nixos/workstation/virtualization/ooknet-install-vm.nix b/modu
les/nixos/virtualization/host/ooknet-install-vm.nix
similarity index 76%
rename from modules/nixos/workstation/virtualization/ooknet-install-vm.nix
rename to modules/nixos/virtualization/host/ooknet-install-vm.nix
index 2cb45e4..1676a1c 100644
--- a/modules/nixos/workstation/virtualization/ooknet-install-vm.nix
+++ b/modules/nixos/virtualization/host/ooknet-install-vm.nix
@@ -2,15 +2,10 @@
   pkgs,
   lib,
   config,
-  self,
   ...
 }: let
   inherit (builtins) toFile;
-  inherit (lib) mkIf mkEnableOption mkOption;
-  inherit (lib.types) path str int;
-  inherit (self.nixosConfigurations.ooksinstall.config.image) filePath;
-  inherit (config.ooknet.host) admin;
-  iso = self.images.ooksinstall;
+  inherit (lib) mkIf;
   checkSudo =
     if config.virtualisation.libvirtd.qemu.runAsRoot
     then ''
@@ -35,80 +30,6 @@
   '';
   cfg = config.ooknet.virtualization.ooknet-install-vm;
 in {
-  options.ooknet.virtualization = {
-    ooknet-install-vm = {
-      enable = mkEnableOption "Enable virtual installation testing environment";
-      isoPath = mkOption {
-        type = path;
-        default = "${iso}/${filePath}";
-        description = "Path to iso to use";
-      };
-      name = mkOption {
-        type = str;
-        default = "ooknet-install-test";
-        description = "Name of virtual machine";
-      };
-      user = mkOption {
-        type = str;
-        default = admin.name;
-        description = "SSH user to connect to virtual machine";
-        example = "root";
-      };
-      macAddress = mkOption {
-        type = str;
-        default = "52:55:00:11:22:33";
-      };
-      ipAddress = mkOption {
-        type = str;
-        default = cfg.network.ipRange.start;
-        description = "IP address to assign to the virtual machine";
-      };
-      ram = mkOption {
-        type = int;
-        default = 2048;
-        description = "Amount of RAM to assign to the virtual machine";
-        example = 2048;
-      };
-      vcpus = mkOption {
-        type = int;
-        default = 2;
-        description = "Amount of cores to assign to the virtual machine";
-        example = 4;
-      };
-      storage = mkOption {
-        type = int;
-        default = 10;
-        description = "Amount in GB of storage to assign to the virtual machine";
-        example = 10;
-      };
-      network = {
-        name = mkOption {
-          type = str;
-          default = "ooknet-install-network";
-          description = "Name of virtual network";
-        };
-        bridgeName = mkOption {
-          type = str;
-          default = "virbr1";
-          description = "Name of virtual network bridge";
-        };
-        ip = mkOption {
-          type = str;
-          default = "192.168.150.1";
-        };
-        ipRange = {
-          start = mkOption {
-            type = str;
-            default = "192.168.150.2";
-          };
-          end = mkOption {
-            type = str;
-            default = "192.168.150.2";
-          };
-        };
-      };
-    };
-  };
   config = mkIf cfg.enable {
     environment.systemPackages = [
       (pkgs.writeShellApplication {

diff --git a/modules/nixos/workstation/virtu
alization/ooknet-install-vm.nix b/modules/ni
xos/virtualization/host/ooknet-install-vm.ni
x
similarity index 76%
rename from modules/nixos/workstation/virtua
lization/ooknet-install-vm.nix
rename to modules/nixos/virtualization/host/
ooknet-install-vm.nix
index 2cb45e4..1676a1c 100644
--- a/modules/nixos/workstation/virtualizati
on/ooknet-install-vm.nix
+++ b/modules/nixos/virtualization/host/ookn
et-install-vm.nix
@@ -2,15 +2,10 @@
   pkgs,
   lib,
   config,
-  self,
   ...
 }: let
   inherit (builtins) toFile;
-  inherit (lib) mkIf mkEnableOption mkOptio
n;
-  inherit (lib.types) path str int;
-  inherit (self.nixosConfigurations.ooksins
tall.config.image) filePath;
-  inherit (config.ooknet.host) admin;
-  iso = self.images.ooksinstall;
+  inherit (lib) mkIf;
   checkSudo =
     if config.virtualisation.libvirtd.qemu.
runAsRoot
     then ''
@@ -35,80 +30,6 @@
   '';
   cfg = config.ooknet.virtualization.ooknet
-install-vm;
 in {
-  options.ooknet.virtualization = {
-    ooknet-install-vm = {
-      enable = mkEnableOption "Enable virtu
al installation testing environment";
-      isoPath = mkOption {
-        type = path;
-        default = "${iso}/${filePath}";
-        description = "Path to iso to use";
-      };
-      name = mkOption {
-        type = str;
-        default = "ooknet-install-test";
-        description = "Name of virtual mach
ine";
-      };
-      user = mkOption {
-        type = str;
-        default = admin.name;
-        description = "SSH user to connect 
to virtual machine";
-        example = "root";
-      };
-      macAddress = mkOption {
-        type = str;
-        default = "52:55:00:11:22:33";
-      };
-      ipAddress = mkOption {
-        type = str;
-        default = cfg.network.ipRange.start
;
-        description = "IP address to assign
 to the virtual machine";
-      };
-      ram = mkOption {
-        type = int;
-        default = 2048;
-        description = "Amount of RAM to ass
ign to the virtual machine";
-        example = 2048;
-      };
-      vcpus = mkOption {
-        type = int;
-        default = 2;
-        description = "Amount of cores to a
ssign to the virtual machine";
-        example = 4;
-      };
-      storage = mkOption {
-        type = int;
-        default = 10;
-        description = "Amount in GB of stor
age to assign to the virtual machine";
-        example = 10;
-      };
-      network = {
-        name = mkOption {
-          type = str;
-          default = "ooknet-install-network
";
-          description = "Name of virtual ne
twork";
-        };
-        bridgeName = mkOption {
-          type = str;
-          default = "virbr1";
-          description = "Name of virtual ne
twork bridge";
-        };
-        ip = mkOption {
-          type = str;
-          default = "192.168.150.1";
-        };
-        ipRange = {
-          start = mkOption {
-            type = str;
-            default = "192.168.150.2";
-          };
-          end = mkOption {
-            type = str;
-            default = "192.168.150.2";
-          };
-        };
-      };
-    };
-  };
   config = mkIf cfg.enable {
     environment.systemPackages = [
       (pkgs.writeShellApplication {
 

diff --git a/modules/nixos/virtualization/host/virt-manager.nix b/modules/nixos/vi
rtualization/host/virt-manager.nix
new file mode 100644
index 0000000..580e397
--- /dev/null
+++ b/modules/nixos/virtualization/host/virt-manager.nix
@@ -0,0 +1,12 @@
+{
+  config,
+  lib,
+  ...
+}: let
+  inherit (lib) mkIf;
+  cfg = config.ooknet.virtualization.host.virt-manager;
+in {
+  config = mkIf cfg.enable {
+    programs.virt-manager.enable = true;
+  };
+}

diff --git a/modules/nixos/virtualization/ho
st/virt-manager.nix b/modules/nixos/virtuali
zation/host/virt-manager.nix
new file mode 100644
index 0000000..580e397
--- /dev/null
+++ b/modules/nixos/virtualization/host/virt
-manager.nix
@@ -0,0 +1,12 @@
+{
+  config,
+  lib,
+  ...
+}: let
+  inherit (lib) mkIf;
+  cfg = config.ooknet.virtualization.host.v
irt-manager;
+in {
+  config = mkIf cfg.enable {
+    programs.virt-manager.enable = true;
+  };
+}
 

diff --git a/modules/nixos/virtualization/options.nix b/modules/nixos/virtualizati
on/options.nix
new file mode 100644
index 0000000..1ea6111
--- /dev/null
+++ b/modules/nixos/virtualization/options.nix
@@ -0,0 +1,113 @@
+{
+  lib,
+  config,
+  self,
+  ...
+}: let
+  inherit (lib) mkOption mkEnableOption;
+  inherit (lib.types) path int str bool nullOr elem enum;
+  inherit (config.ooknet) host;
+  inherit (config.ooknet) workstation;
+  inherit (config.ooknet.host) admin;
+  cfg = config.ooknet.virtualization;
+in {
+  options.ooknet.virtualization = {
+    guest = {
+      enable = mkOption {
+        type = bool;
+        default = host.type == "vm";
+        description = "Enable ooknet vm module";
+      };
+      type = mkOption {
+        type = nullOr (enum ["qemu" "vmware" "hyperv"]);
+        description = "The type of virtualization to configure for";
+        default = null;
+      };
+    };
+
+    host = {
+      enable = mkOption {
+        type = bool;
+        default = elem "virtualization" workstation.profiles;
+        description = "Enable ooknet vm module";
+      };
+      virt-manager.enable = mkEnableOption "Enable libvirtd graphical front end v
irt-manager";
+
+      ooknet-install-vm = let
+        inherit (self.nixosConfigurations.ooksinstall.config.image) filePath;
+        iso = self.images.ooksinstall;
+      in {
+        enable = mkEnableOption "Enable virtual installation testing environment"
;
+        isoPath = mkOption {
+          type = path;
+          default = "${iso}/${filePath}";
+          description = "Path to iso to use";
+        };
+        name = mkOption {
+          type = str;
+          default = "ooknet-install-test";
+          description = "Name of virtual machine";
+        };
+        user = mkOption {
+          type = str;
+          default = admin.name;
+          description = "SSH user to connect to virtual machine";
+          example = "root";
+        };
+        macAddress = mkOption {
+          type = str;
+          default = "52:55:00:11:22:33";
+        };
+        ipAddress = mkOption {
+          type = str;
+          default = cfg.host.ooknet-install-vm.network.ipRange.start;
+          description = "IP address to assign to the virtual machine";
+        };
+        ram = mkOption {
+          type = int;
+          default = 2048;
+          description = "Amount of RAM to assign to the virtual machine";
+          example = 2048;
+        };
+        vcpus = mkOption {
+          type = int;
+          default = 2;
+          description = "Amount of cores to assign to the virtual machine";
+          example = 4;
+        };
+        storage = mkOption {
+          type = int;
+          default = 10;
+          description = "Amount in GB of storage to assign to the virtual machine
";
+          example = 10;
+        };
+        network = {
+          name = mkOption {
+            type = str;
+            default = "ooknet-install-network";
+            description = "Name of virtual network";
+          };
+          bridgeName = mkOption {
+            type = str;
+            default = "virbr1";
+            description = "Name of virtual network bridge";
+          };
+          ip = mkOption {
+            type = str;
+            default = "192.168.150.1";
+          };
+          ipRange = {
+            start = mkOption {
+              type = str;
+              default = "192.168.150.2";
+            };
+            end = mkOption {
+              type = str;
+              default = "192.168.150.2";
+            };
+          };
+        };
+      };
+    };
+  };
+}

diff --git a/modules/nixos/virtualization/op
tions.nix b/modules/nixos/virtualization/opt
ions.nix
new file mode 100644
index 0000000..1ea6111
--- /dev/null
+++ b/modules/nixos/virtualization/options.n
ix
@@ -0,0 +1,113 @@
+{
+  lib,
+  config,
+  self,
+  ...
+}: let
+  inherit (lib) mkOption mkEnableOption;
+  inherit (lib.types) path int str bool nul
lOr elem enum;
+  inherit (config.ooknet) host;
+  inherit (config.ooknet) workstation;
+  inherit (config.ooknet.host) admin;
+  cfg = config.ooknet.virtualization;
+in {
+  options.ooknet.virtualization = {
+    guest = {
+      enable = mkOption {
+        type = bool;
+        default = host.type == "vm";
+        description = "Enable ooknet vm mod
ule";
+      };
+      type = mkOption {
+        type = nullOr (enum ["qemu" "vmware
" "hyperv"]);
+        description = "The type of virtuali
zation to configure for";
+        default = null;
+      };
+    };
+
+    host = {
+      enable = mkOption {
+        type = bool;
+        default = elem "virtualization" wor
kstation.profiles;
+        description = "Enable ooknet vm mod
ule";
+      };
+      virt-manager.enable = mkEnableOption 
"Enable libvirtd graphical front end virt-ma
nager";
+
+      ooknet-install-vm = let
+        inherit (self.nixosConfigurations.o
oksinstall.config.image) filePath;
+        iso = self.images.ooksinstall;
+      in {
+        enable = mkEnableOption "Enable vir
tual installation testing environment";
+        isoPath = mkOption {
+          type = path;
+          default = "${iso}/${filePath}";
+          description = "Path to iso to use
";
+        };
+        name = mkOption {
+          type = str;
+          default = "ooknet-install-test";
+          description = "Name of virtual ma
chine";
+        };
+        user = mkOption {
+          type = str;
+          default = admin.name;
+          description = "SSH user to connec
t to virtual machine";
+          example = "root";
+        };
+        macAddress = mkOption {
+          type = str;
+          default = "52:55:00:11:22:33";
+        };
+        ipAddress = mkOption {
+          type = str;
+          default = cfg.host.ooknet-install
-vm.network.ipRange.start;
+          description = "IP address to assi
gn to the virtual machine";
+        };
+        ram = mkOption {
+          type = int;
+          default = 2048;
+          description = "Amount of RAM to a
ssign to the virtual machine";
+          example = 2048;
+        };
+        vcpus = mkOption {
+          type = int;
+          default = 2;
+          description = "Amount of cores to
 assign to the virtual machine";
+          example = 4;
+        };
+        storage = mkOption {
+          type = int;
+          default = 10;
+          description = "Amount in GB of st
orage to assign to the virtual machine";
+          example = 10;
+        };
+        network = {
+          name = mkOption {
+            type = str;
+            default = "ooknet-install-netwo
rk";
+            description = "Name of virtual 
network";
+          };
+          bridgeName = mkOption {
+            type = str;
+            default = "virbr1";
+            description = "Name of virtual 
network bridge";
+          };
+          ip = mkOption {
+            type = str;
+            default = "192.168.150.1";
+          };
+          ipRange = {
+            start = mkOption {
+              type = str;
+              default = "192.168.150.2";
+            };
+            end = mkOption {
+              type = str;
+              default = "192.168.150.2";
+            };
+          };
+        };
+      };
+    };
+  };
+}
 

diff --git a/outputs/lib/builders.nix b/outputs/lib/builders.nix
index 4315e54..e60d7a3 100644
--- a/outputs/lib/builders.nix
+++ b/outputs/lib/builders.nix
@@ -24,6 +24,7 @@
     server = nixosModules + "/server";
     image = nixosModules + "/image";
     workstation = nixosModules + "/workstation";
+    virtualization = nixosModules + "/virtualization";
   };
   common = {
     base = commonModules + "/base";
@@ -49,6 +50,7 @@
     ++ [
       nixos.base
       nixos.hardware
+      nixos.virtualization
       nixos-hm
       nixosSecrets
     ];

diff --git a/outputs/lib/builders.nix b/outp
uts/lib/builders.nix
index 4315e54..e60d7a3 100644
--- a/outputs/lib/builders.nix
+++ b/outputs/lib/builders.nix
@@ -24,6 +24,7 @@
     server = nixosModules + "/server";
     image = nixosModules + "/image";
     workstation = nixosModules + "/workstat
ion";
+    virtualization = nixosModules + "/virtu
alization";
   };
   common = {
     base = commonModules + "/base";
@@ -49,6 +50,7 @@
     ++ [
       nixos.base
       nixos.hardware
+      nixos.virtualization
       nixos-hm
       nixosSecrets
     ];
 

diff --git a/qemuGuest.nix b/qemuGuest.nix
new file mode 100644
index 0000000..cff33a8
--- /dev/null
+++ b/qemuGuest.nix
@@ -0,0 +1,28 @@
+{
+  config,
+  lib,
+  ...
+}: let
+  inherit (config.ooknet.host) vm;
+  inherit (lib) mkIf;
+in {
+  config = mkIf (vm.type == "qemu") {
+    services.qemuGuest.enable = true;
+    boot.initrd = {
+      availableKernelModules = [
+        "virtio_net"
+        "virtio_mmio"
+        "virtio_blk"
+        "virtio_scsi"
+        "9p"
+        "9pnet_virtio"
+      ];
+      kernelModules = [
+        "virtio_balloon"
+        "virtio_console"
+        "virtio_rng"
+        "virtio_gpu"
+      ];
+    };
+  };
+}

diff --git a/qemuGuest.nix b/qemuGuest.nix
new file mode 100644
index 0000000..cff33a8
--- /dev/null
+++ b/qemuGuest.nix
@@ -0,0 +1,28 @@
+{
+  config,
+  lib,
+  ...
+}: let
+  inherit (config.ooknet.host) vm;
+  inherit (lib) mkIf;
+in {
+  config = mkIf (vm.type == "qemu") {
+    services.qemuGuest.enable = true;
+    boot.initrd = {
+      availableKernelModules = [
+        "virtio_net"
+        "virtio_mmio"
+        "virtio_blk"
+        "virtio_scsi"
+        "9p"
+        "9pnet_virtio"
+      ];
+      kernelModules = [
+        "virtio_balloon"
+        "virtio_console"
+        "virtio_rng"
+        "virtio_gpu"
+      ];
+    };
+  };
+}
 
[ BACK TO LOG ]
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET