diff --git a/nix-kubernetes/coder.nix b/nix-kubernetes/coder.nix index 9b637c1..b370ee2 100644 --- a/nix-kubernetes/coder.nix +++ b/nix-kubernetes/coder.nix @@ -77,6 +77,12 @@ if [ ! -z "$DOTFILES_REPO" ]; then echo "Dotfiles present, reloading home-manager profile" reload-dotfiles + # the homeConfiguration can specify a program "coder_startup", run it + # here if it exists + if command -v coder_startup &> /dev/null; then + echo "Running startup tasks..." + coder_startup + fi else echo "No dotfiles repo specified, skipping..." fi @@ -84,5 +90,17 @@ run_on_start = true; start_blocks_login = true; }; + coder_script."home-manager-shutdown" = { + agent_id = "\${coder_agent.coder.id}"; + display_name = "Home Manager Shutdown"; + icon = "/emojis/1f3e0.png"; + script = '' + if command -v coder_shutdown &> /dev/null; then + echo "Running shutdown tasks..." + coder_shutdown + fi + ''; + run_on_stop = true; + }; }; }