forked from mirrors/nixpkgs
nixos/multipass: init
This commit is contained in:
parent
db9d730b1e
commit
63e3f8da09
|
@ -1364,6 +1364,7 @@
|
|||
./virtualisation/lxc.nix
|
||||
./virtualisation/lxcfs.nix
|
||||
./virtualisation/lxd.nix
|
||||
./virtualisation/multipass.nix
|
||||
./virtualisation/nixos-containers.nix
|
||||
./virtualisation/oci-containers.nix
|
||||
./virtualisation/openstack-options.nix
|
||||
|
|
61
nixos/modules/virtualisation/multipass.nix
Normal file
61
nixos/modules/virtualisation/multipass.nix
Normal file
|
@ -0,0 +1,61 @@
|
|||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.virtualisation.multipass;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
virtualisation.multipass = {
|
||||
enable = lib.mkEnableOption (lib.mdDoc ''
|
||||
Multipass, a simple manager for virtualised Ubuntu instances.
|
||||
'');
|
||||
|
||||
logLevel = lib.mkOption {
|
||||
type = lib.types.enum [ "error" "warning" "info" "debug" "trace" ];
|
||||
default = "debug";
|
||||
description = lib.mdDoc ''
|
||||
The logging verbosity of the multipassd binary.
|
||||
'';
|
||||
};
|
||||
|
||||
package = lib.mkPackageOptionMD pkgs "multipass" { };
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
|
||||
systemd.services.multipass = {
|
||||
description = "Multipass orchestrates virtual Ubuntu instances.";
|
||||
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wants = [ "network.target" ];
|
||||
after = [ "network.target" ];
|
||||
|
||||
environment = {
|
||||
"XDG_DATA_HOME" = "/var/lib/multipass/data";
|
||||
"XDG_CACHE_HOME" = "/var/lib/multipass/cache";
|
||||
"XDG_CONFIG_HOME" = "/var/lib/multipass/config";
|
||||
};
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart = "${cfg.package}/bin/multipassd --logger platform --verbosity ${cfg.logLevel}";
|
||||
SyslogIdentifer = "multipassd";
|
||||
Restart = "on-failure";
|
||||
TimeoutStopSec = 300;
|
||||
Type = "simple";
|
||||
|
||||
WorkingDirectory = "/var/lib/multipass";
|
||||
|
||||
StateDirectory = "multipass";
|
||||
StateDirectoryMode = "0750";
|
||||
CacheDirectory = "multipass";
|
||||
CacheDirectoryMode = "0750";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue