aboutsummaryrefslogtreecommitdiff
path: root/services/colima.nix
diff options
context:
space:
mode:
Diffstat (limited to 'services/colima.nix')
-rw-r--r--services/colima.nix46
1 files changed, 46 insertions, 0 deletions
diff --git a/services/colima.nix b/services/colima.nix
new file mode 100644
index 0000000..c3f1f82
--- /dev/null
+++ b/services/colima.nix
@@ -0,0 +1,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;
+ };
+ };
+ })
+ ];
+}