2022-05-20 12:21:27 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.virtualisation.appvm;
|
|
|
|
|
|
|
|
in {
|
|
|
|
|
|
|
|
options = {
|
|
|
|
virtualisation.appvm = {
|
|
|
|
enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc ''
|
2022-05-20 12:21:27 +00:00
|
|
|
This enables AppVMs and related virtualisation settings.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
user = mkOption {
|
|
|
|
type = types.str;
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc ''
|
2022-05-20 12:21:27 +00:00
|
|
|
AppVM user login. Currenly only AppVMs are supported for a single user only.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
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" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|