Allow enabling spice

This commit is contained in:
Manuel Thalmann 2024-05-01 03:07:42 +02:00
parent 8b4c67b89d
commit 2b5fe69994

View file

@ -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