blob: c3f1f82dfadf17aa29d4351dcebb2fbd84b44293 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
{ config, lib, pkgs, ... }:
let
cfg = config.services.colima;
in
{
options = {
services.colima = {
enable = lib.mkEnableOption "Autostart Colima";
package = lib.mkOption {
type = lib.types.package;
default = pkgs.colima;
defaultText = lib.literalExpression "pkgs.colima";
description = "Package providing {command}`colima`.";
};
extraOptions = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
example = [ "--cpu 1" ];
description = ''
Extra command-line arguments to pass to {command}`colima start`.
'';
};
};
};
config = lib.mkMerge [
(lib.mkIf cfg.enable {
home.packages = [ cfg.package ];
launchd.agents.colima = {
enable = true;
config = {
EnvironmentVariables = {
PATH = "${pkgs.docker-client}/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin";
};
ProgramArguments = [ "${cfg.package}/bin/colima" "start" "-f" ] ++ cfg.extraOptions;
KeepAlive = true;
RunAtLoad = true;
};
};
})
];
}
|