diff --git a/lib/config/custom-build-vm.nix b/lib/config/custom-build-vm.nix index 91ad630..5d42460 100644 --- a/lib/config/custom-build-vm.nix +++ b/lib/config/custom-build-vm.nix @@ -31,9 +31,25 @@ in { default = false; }; - qemu.runInBackground = lib.mkOption { - type = lib.types.bool; - default = false; + qemu = { + runInBackground = lib.mkOption { + type = lib.types.bool; + default = false; + }; + + spice = { + enable = lib.mkEnableOption "spice"; + + bindAddress = lib.mkOption { + type = lib.types.str; + default = "127.0.0.1"; + }; + + port = lib.mkOption { + type = lib.types.port; + default = 5900; + }; + }; }; }; }; @@ -54,6 +70,19 @@ in { virtualisation = { runAsRoot = lib.mkIf vmVariant.virtualisation.sharedHostKeys true; + qemu.options = + with { + inherit (vmVariant.virtualisation.qemu) spice; + }; + ( + lib.optional (spice.enable) + ("-spice " + ( + lib.concatStringsSep "," [ + "addr=${lib.escapeShellArg spice.bindAddress}" + "port=${toString spice.port}" + "disable-ticketing=on" + ]))); + sharedDirectories = lib.optionalAttrs (vmVariant.virtualisation.sharedHostKeys) { hostKeys = let