1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6
7 cfg = config.virtualisation.appvm;
8
9in {
10
11 options = {
12 virtualisation.appvm = {
13 enable = mkOption {
14 type = types.bool;
15 default = false;
16 description = ''
17 This enables AppVMs and related virtualisation settings.
18 '';
19 };
20 user = mkOption {
21 type = types.str;
22 description = ''
23 AppVM user login. Currently only AppVMs are supported for a single user only.
24 '';
25 };
26 };
27
28 };
29
30 config = mkIf cfg.enable {
31 virtualisation.libvirtd = {
32 enable = true;
33 qemu.verbatimConfig = ''
34 namespaces = []
35 user = "${cfg.user}"
36 group = "users"
37 remember_owner = 0
38 '';
39 };
40
41 users.users."${cfg.user}" = {
42 packages = [ pkgs.appvm ];
43 extraGroups = [ "libvirtd" ];
44 };
45
46 };
47
48}
49