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,10 +31,26 @@ in {
default = false; default = false;
}; };
qemu.runInBackground = lib.mkOption { qemu = {
runInBackground = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = false; 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;
};
};
};
}; };
}; };
in { in {
@ -54,6 +70,19 @@ in {
virtualisation = { virtualisation = {
runAsRoot = lib.mkIf vmVariant.virtualisation.sharedHostKeys true; 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) { sharedDirectories = lib.optionalAttrs (vmVariant.virtualisation.sharedHostKeys) {
hostKeys = hostKeys =
let let