mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 06:00:33 +03:00
nixos/appvm: init at unstable-2021-12-20
Co-authored-by: Mikhail Klementev <blame@dumpstack.io> Co-authored-by: Cabia Rangris <me@cab404.ru>
This commit is contained in:
parent
87d9910cef
commit
f81c763c1d
10 changed files with 157 additions and 3 deletions
49
nixos/modules/virtualisation/appvm.nix
Normal file
49
nixos/modules/virtualisation/appvm.nix
Normal file
|
@ -0,0 +1,49 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.virtualisation.appvm;
|
||||
|
||||
in {
|
||||
|
||||
options = {
|
||||
virtualisation.appvm = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
This enables AppVMs and related virtualisation settings.
|
||||
'';
|
||||
};
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
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" ];
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue