diff --git a/hosts/cm.nix b/hosts/cm.nix index 7b2d1f2..4de621a 100644 --- a/hosts/cm.nix +++ b/hosts/cm.nix @@ -13,12 +13,7 @@ }; homebrew = { - brews = [ - { - name = "container"; - start_service = true; - } - ]; + brews = [ "container" ]; casks = [ "ghostty" "logseq" @@ -55,6 +50,7 @@ ../modules/kubernetes.nix ../modules/vault.nix ../modules/redocly.nix + ../modules/container.nix { my.userEmail = "pawel.pacana@chattermill.io"; programs.git.settings.init.defaultBranch = "main"; # work convention diff --git a/modules/container.nix b/modules/container.nix new file mode 100644 index 0000000..ac01b55 --- /dev/null +++ b/modules/container.nix @@ -0,0 +1,28 @@ +{ lib, ... }: + +{ + home.activation.stopHomebrewContainerService = lib.hm.dag.entryBefore [ "setupLaunchAgents" ] '' + if /bin/launchctl print "user/$UID/homebrew.mxcl.container" >/dev/null 2>&1; then + run /bin/launchctl bootout "user/$UID/homebrew.mxcl.container" + fi + if /bin/launchctl print "gui/$UID/homebrew.mxcl.container" >/dev/null 2>&1; then + run /bin/launchctl bootout "gui/$UID/homebrew.mxcl.container" + fi + run rm -f "$HOME/Library/LaunchAgents/homebrew.mxcl.container.plist" + ''; + + launchd.agents.container-system-start = { + enable = true; + domain = "user"; + config = { + ProgramArguments = [ + "/opt/homebrew/bin/container" + "system" + "start" + ]; + RunAtLoad = true; + StandardOutPath = "/opt/homebrew/var/log/container.log"; + StandardErrorPath = "/opt/homebrew/var/log/container.log"; + }; + }; +}