at 23.11-pre 1.6 kB view raw
1{ config 2, lib 3, pkgs 4, ... 5}: 6 7let 8 cfg = config.virtualisation.multipass; 9in 10{ 11 options = { 12 virtualisation.multipass = { 13 enable = lib.mkEnableOption (lib.mdDoc '' 14 Multipass, a simple manager for virtualised Ubuntu instances. 15 ''); 16 17 logLevel = lib.mkOption { 18 type = lib.types.enum [ "error" "warning" "info" "debug" "trace" ]; 19 default = "debug"; 20 description = lib.mdDoc '' 21 The logging verbosity of the multipassd binary. 22 ''; 23 }; 24 25 package = lib.mkPackageOptionMD pkgs "multipass" { }; 26 }; 27 }; 28 29 config = lib.mkIf cfg.enable { 30 environment.systemPackages = [ cfg.package ]; 31 32 systemd.services.multipass = { 33 description = "Multipass orchestrates virtual Ubuntu instances."; 34 35 wantedBy = [ "multi-user.target" ]; 36 wants = [ "network-online.target" ]; 37 after = [ "network-online.target" ]; 38 39 environment = { 40 "XDG_DATA_HOME" = "/var/lib/multipass/data"; 41 "XDG_CACHE_HOME" = "/var/lib/multipass/cache"; 42 "XDG_CONFIG_HOME" = "/var/lib/multipass/config"; 43 }; 44 45 serviceConfig = { 46 ExecStart = "${cfg.package}/bin/multipassd --logger platform --verbosity ${cfg.logLevel}"; 47 SyslogIdentifier = "multipassd"; 48 Restart = "on-failure"; 49 TimeoutStopSec = 300; 50 Type = "simple"; 51 52 WorkingDirectory = "/var/lib/multipass"; 53 54 StateDirectory = "multipass"; 55 StateDirectoryMode = "0750"; 56 CacheDirectory = "multipass"; 57 CacheDirectoryMode = "0750"; 58 }; 59 }; 60 }; 61}