nixos configuration module

This commit is contained in:
Vladimir Serov 2020-07-14 01:59:17 +03:00 committed by Mikhail Klementev
parent 77eada72c3
commit 5376e7a56f

40
nixos/default.nix Normal file
View File

@ -0,0 +1,40 @@
params@{ config, lib, pkgs, ... }:
let
cfg = config.virtualisation.appvm;
appvm = import ../. params;
in with lib; {
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;
qemuVerbatimConfig = ''
namespaces = []
user = "${cfg.user}"
group = "users"
'';
};
users.users."${cfg.user}".packages = [ appvm ];
};
}