diff options
author | Christian Segundo | 2024-02-24 11:59:44 +0100 |
---|---|---|
committer | Christian Segundo | 2024-02-24 12:24:35 +0100 |
commit | 5c765e068bf16ca063b9a16f5c1e8ba996d07426 (patch) | |
tree | 7d66ae5b65587b1dc806e90f0a01286f8c619b1c /services/colima.nix | |
parent | 08a637a6aa6bc856eadb73b6754af12a9b899c2d (diff) | |
download | hm-extra-5c765e068bf16ca063b9a16f5c1e8ba996d07426.tar.gz |
Add Colima and Docker
Diffstat (limited to 'services/colima.nix')
-rw-r--r-- | services/colima.nix | 46 |
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; + }; + }; + }) + ]; +} |