2023-02-09 11:40:11 +00:00
|
|
|
{ config
|
|
|
|
, lib
|
|
|
|
, pkgs
|
|
|
|
, ...
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.virtualisation.multipass;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
virtualisation.multipass = {
|
2024-04-21 15:54:59 +00:00
|
|
|
enable = lib.mkEnableOption ''
|
2023-02-09 11:40:11 +00:00
|
|
|
Multipass, a simple manager for virtualised Ubuntu instances.
|
2024-04-21 15:54:59 +00:00
|
|
|
'';
|
2023-02-09 11:40:11 +00:00
|
|
|
|
|
|
|
logLevel = lib.mkOption {
|
|
|
|
type = lib.types.enum [ "error" "warning" "info" "debug" "trace" ];
|
|
|
|
default = "debug";
|
2024-04-21 15:54:59 +00:00
|
|
|
description = ''
|
2023-02-09 11:40:11 +00:00
|
|
|
The logging verbosity of the multipassd binary.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
package = lib.mkPackageOption pkgs "multipass" { };
|
2023-02-09 11:40:11 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
environment.systemPackages = [ cfg.package ];
|
|
|
|
|
|
|
|
systemd.services.multipass = {
|
|
|
|
description = "Multipass orchestrates virtual Ubuntu instances.";
|
|
|
|
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
2023-04-29 16:46:19 +00:00
|
|
|
wants = [ "network-online.target" ];
|
|
|
|
after = [ "network-online.target" ];
|
2023-02-09 11:40:11 +00:00
|
|
|
|
|
|
|
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}";
|
2023-03-04 12:14:45 +00:00
|
|
|
SyslogIdentifier = "multipassd";
|
2023-02-09 11:40:11 +00:00
|
|
|
Restart = "on-failure";
|
|
|
|
TimeoutStopSec = 300;
|
|
|
|
Type = "simple";
|
|
|
|
|
|
|
|
WorkingDirectory = "/var/lib/multipass";
|
|
|
|
|
|
|
|
StateDirectory = "multipass";
|
|
|
|
StateDirectoryMode = "0750";
|
|
|
|
CacheDirectory = "multipass";
|
|
|
|
CacheDirectoryMode = "0750";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|