nixpkgs/nixos/modules/virtualisation/multipass.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

60 lines
1.5 KiB
Nix
Raw Normal View History

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