create qemu module
This commit is contained in:
		| @@ -86,27 +86,6 @@ | ||||
|   security.polkit.enable = true; | ||||
|   environment.sessionVariables.NIXOS_OZONE_WL = "1"; | ||||
|  | ||||
|   virtualisation = { | ||||
|     libvirtd = { | ||||
|       enable = true; | ||||
|       qemu = { | ||||
|         package = pkgs.qemu_kvm; | ||||
|         runAsRoot = true; | ||||
|         swtpm.enable = true; | ||||
|         ovmf = { | ||||
|           enable = true; | ||||
|           packages = [ | ||||
|             (pkgs.OVMF.override { | ||||
|               secureBoot = true; | ||||
|               tpmSupport = true; | ||||
|             }) | ||||
|             .fd | ||||
|           ]; | ||||
|         }; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
|  | ||||
|   # List services that you want to enable: | ||||
|  | ||||
|   # fingerprint unlock | ||||
|   | ||||
| @@ -1,11 +1,12 @@ | ||||
| { | ||||
|   lib, | ||||
|   config, | ||||
|   system, | ||||
|   ... | ||||
| }: let | ||||
|   cfg = config.myConfig; | ||||
| in { | ||||
|   imports = [./bootloader.nix ./locale.nix ./greetd.nix ./rebuild.nix ./sops.nix ./sway.nix ./wifi.nix ./music.nix ./cups.nix ./gpu/amd.nix ./touch.nix ./cache.nix ./nix.nix ./update.nix ./podman.nix]; | ||||
|   imports = [./bootloader.nix ./locale.nix ./greetd.nix ./rebuild.nix ./sops.nix ./sway.nix ./wifi.nix ./music.nix ./cups.nix ./gpu/amd.nix ./touch.nix ./cache.nix ./nix.nix ./update.nix ./podman.nix ./qemu.nix]; | ||||
|  | ||||
|   options.myConfig = { | ||||
|     enable = lib.mkEnableOption "my custom config"; | ||||
| @@ -27,6 +28,8 @@ in { | ||||
|     cache.enable = true; | ||||
|     autoUpdate.enable = true; | ||||
|     podman.enable = true; | ||||
|     qemu.enable = true; | ||||
|     qemu.kvm = lib.mkIf (system == "x86_64-linux") true; | ||||
|  | ||||
|     greetd.enable = lib.mkIf cfg.desktop true; | ||||
|     sway.enable = lib.mkIf cfg.desktop true; | ||||
|   | ||||
							
								
								
									
										35
									
								
								modules/nixos/qemu.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								modules/nixos/qemu.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,35 @@ | ||||
| { | ||||
|   lib, | ||||
|   config, | ||||
|   pkgs, | ||||
|   ... | ||||
| }: let | ||||
|   cfg = config.myConfig.qemu; | ||||
| in { | ||||
|   options.myConfig.qemu = { | ||||
|     enable = lib.mkEnableOption "qemu"; | ||||
|     kvm = lib.mkEnableOption "kvm for faster emulation of x86"; | ||||
|   }; | ||||
|  | ||||
|   config = lib.mkIf cfg.enable { | ||||
|     virtualisation. | ||||
|     libvirtd = { | ||||
|       enable = true; | ||||
|       qemu = { | ||||
|         package = lib.mkIf cfg.kvm pkgs.qemu_kvm; | ||||
|         runAsRoot = true; | ||||
|         swtpm.enable = true; | ||||
|         ovmf = { | ||||
|           enable = true; | ||||
|           packages = [ | ||||
|             (pkgs.OVMF.override { | ||||
|               secureBoot = true; | ||||
|               tpmSupport = true; | ||||
|             }) | ||||
|             .fd | ||||
|           ]; | ||||
|         }; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user