2022-06-16 17:23:12 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.virtualisation.appvm;
|
|
|
|
|
|
|
|
in {
|
|
|
|
|
|
|
|
options = {
|
|
|
|
virtualisation.appvm = {
|
|
|
|
enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc ''
|
2022-06-16 17:23:12 +00:00
|
|
|
This enables AppVMs and related virtualisation settings.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
user = mkOption {
|
|
|
|
type = types.str;
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc ''
|
2022-12-28 21:21:41 +00:00
|
|
|
AppVM user login. Currently only AppVMs are supported for a single user only.
|
2022-06-16 17:23:12 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
virtualisation.libvirtd = {
|
|
|
|
enable = true;
|
|
|
|
qemu.verbatimConfig = ''
|
|
|
|
namespaces = []
|
|
|
|
user = "${cfg.user}"
|
|
|
|
group = "users"
|
|
|
|
remember_owner = 0
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
users.users."${cfg.user}" = {
|
|
|
|
packages = [ pkgs.appvm ];
|
|
|
|
extraGroups = [ "libvirtd" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|