diff --git a/flake.lock b/flake.lock index da7e835..6190cf6 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,26 @@ { "nodes": { + "NixVirt": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1732406038, + "narHash": "sha256-BYNBN+Rtc/SX6qI7m3nmryufRPn0ZYd40yHDo9VQaNE=", + "owner": "AshleyYakeley", + "repo": "NixVirt", + "rev": "fe3aaa86d4458e4f84348941297f7ba82e2a9f67", + "type": "github" + }, + "original": { + "owner": "AshleyYakeley", + "repo": "NixVirt", + "rev": "fe3aaa86d4458e4f84348941297f7ba82e2a9f67", + "type": "github" + } + }, "aquamarine": { "inputs": { "hyprutils": [ @@ -942,6 +963,7 @@ }, "root": { "inputs": { + "NixVirt": "NixVirt", "comin": "comin", "f1multiviewer": "f1multiviewer", "ghostty": "ghostty", diff --git a/flake.nix b/flake.nix index ef04605..81343d7 100644 --- a/flake.nix +++ b/flake.nix @@ -83,6 +83,12 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + NixVirt = { + # master as of 2024.12.12 + url = "github:AshleyYakeley/NixVirt?rev=fe3aaa86d4458e4f84348941297f7ba82e2a9f67"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + # roc = { # url = "github:roc-lang/roc"; # inputs.nixpkgs.follows = "nixpkgs"; diff --git a/hosts/othalan/default.nix b/hosts/othalan/default.nix index 039ab2c..f6df1ba 100644 --- a/hosts/othalan/default.nix +++ b/hosts/othalan/default.nix @@ -6,6 +6,7 @@ ... }: { + oizys = { nix-ld = enabled // { diff --git a/hosts/othalan/virt.nix b/hosts/othalan/virt.nix deleted file mode 100644 index a501b66..0000000 --- a/hosts/othalan/virt.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - pkgs, - enabled, - ... -}: -{ - programs.virt-manager = enabled; - - virtualisation = { - libvirtd = enabled // { - # Enable TPM emulation (optional) - qemu = { - swtpm = enabled; - ovmf.packages = [ pkgs.OVMFFull.fd ]; - vhostUserPackages = [ pkgs.virtiofsd ]; - }; - - }; - - # Enable USB redirection (optional) - spiceUSBRedirection = enabled; - }; - - users.users.daylin = { - extraGroups = [ "libvirtd" ]; - }; -} diff --git a/hosts/othalan/virt/default.nix b/hosts/othalan/virt/default.nix new file mode 100644 index 0000000..a940532 --- /dev/null +++ b/hosts/othalan/virt/default.nix @@ -0,0 +1,48 @@ +{ + inputs, + pkgs, + flake, + enabled, + ... +}: +let + inherit (inputs) NixVirt; + defaultNetwork = { + definition = NixVirt.lib.network.writeXML ( + NixVirt.lib.network.templates.bridge { + uuid = "e7955c23-8750-4405-ab2c-37aeee441f67"; + subnet_byte = 24; + } + ); + }; +in +{ + imports = [ + (flake.module "NixVirt") + ]; + + programs.virt-manager = enabled; + + virtualisation = { + libvirt = enabled // { + swtpm = enabled; + connections."qemu:///system" = { + networks = [ defaultNetwork ]; + domains = [ + { definition = ./win11.xml; } + ]; + }; + }; + libvirtd.qemu = { + # ovmf.packages = [ pkgs.OVMFFull.fd ]; + vhostUserPackages = [ pkgs.virtiofsd ]; + }; + + # Enable USB redirection (optional) + spiceUSBRedirection = enabled; + }; + + users.users.daylin = { + extraGroups = [ "libvirtd" ]; + }; +} diff --git a/hosts/othalan/virt/win11.xml b/hosts/othalan/virt/win11.xml new file mode 100644 index 0000000..24e901b --- /dev/null +++ b/hosts/othalan/virt/win11.xml @@ -0,0 +1,215 @@ + + win11 + 696578df-2a3d-4c40-814d-8d126a5699cd + + + + + + 16777216 + 16777216 + + + + + 4 + + hvm + /run/libvirt/nix-ovmf/OVMF_CODE.fd + /var/lib/libvirt/qemu/nvram/win11_VARS.fd + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + destroy + restart + destroy + + + + + + /run/libvirt/nix-emulators/qemu-system-x86_64 + + + + +
+ + + + + + +
+ + + + + + +
+ + +
+ + + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + +
+ + +
+ + + + + +
+ + + + + +
+ + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+ +