nix/home/scripts.nix
Harivansh Rathi 8ad1784a82 Add netty worktree helpers
Add netty-specific worktree helper commands and a zsh wrapper that creates sibling worktrees and cds into them.

Also split script packaging so Darwin keeps the existing wt integration while netty gets git-worktree-based helpers.

Co-authored-by: Codex <noreply@openai.com>
2026-03-30 16:37:46 +00:00

41 lines
1.6 KiB
Nix

{
config,
lib,
pkgs,
...
}: let
customScripts = import ../scripts {inherit config lib pkgs;};
in {
home.packages =
builtins.attrValues customScripts.commonPackages
++ lib.optionals pkgs.stdenv.isDarwin (builtins.attrValues customScripts.darwinPackages);
home.activation.initializeThemeState = lib.hm.dag.entryAfter ["writeBoundary"] ''
mkdir -p "${customScripts.theme.paths.stateDir}" "${customScripts.theme.paths.fzfDir}" "${customScripts.theme.paths.ghosttyDir}" "${customScripts.theme.paths.tmuxDir}"
if [[ -f "${customScripts.theme.paths.stateFile}" ]]; then
mode=$(tr -d '[:space:]' < "${customScripts.theme.paths.stateFile}")
else
mode="${customScripts.theme.defaultMode}"
printf '%s\n' "$mode" > "${customScripts.theme.paths.stateFile}"
fi
case "$mode" in
light)
fzf_target="${customScripts.theme.paths.fzfDir}/cozybox-light"
ghostty_target="${customScripts.theme.paths.ghosttyDir}/cozybox-light"
tmux_target="${customScripts.tmuxConfigs.light}"
;;
*)
printf '%s\n' "${customScripts.theme.defaultMode}" > "${customScripts.theme.paths.stateFile}"
fzf_target="${customScripts.theme.paths.fzfDir}/cozybox-dark"
ghostty_target="${customScripts.theme.paths.ghosttyDir}/cozybox-dark"
tmux_target="${customScripts.tmuxConfigs.dark}"
;;
esac
ln -sfn "$fzf_target" "${customScripts.theme.paths.fzfCurrentFile}"
ln -sfn "$ghostty_target" "${customScripts.theme.paths.ghosttyCurrentFile}"
ln -sfn "$tmux_target" "${customScripts.theme.paths.tmuxCurrentFile}"
'';
}