diff --git a/home-manager.nix b/home-manager.nix index 71c9c96..70beb3d 100644 --- a/home-manager.nix +++ b/home-manager.nix @@ -99,6 +99,20 @@ in { initExtra = '' which apt >/dev/null 2>&1 && plugins=("\$\{(@)plugins:#tmux-my\}") + + # git does not support shell aliases as subcommands, but also + # there is no way to change the current working directory from + # the subprocess. Emulating the required behavior with the wrapper + function git { + if [[ "$1" = "get" ]]; then + REPO=$(echo $2 | sed 's;http.*://;;') + REPO=$(echo $REPO | sed 's;\.git$;;') + ${pkgs.git}/bin/git clone https://$REPO $GOPATH/src/$REPO + cd $GOPATH/src/$REPO + else + ${pkgs.git}/bin/git $@ + fi + } ''; }; diff --git a/packages.nix b/packages.nix index 7dc24ec..43091c0 100644 --- a/packages.nix +++ b/packages.nix @@ -130,11 +130,6 @@ in { ghidra - (writeShellScriptBin "git-get" '' - REPO=$(echo $1 | sed 's;http.*://;;') - ${git}/bin/git clone https://$REPO $GOPATH/src/$REPO - '') - (writeShellScriptBin "chromium" '' ${chromium}/bin/chromium --force-dark-mode \ --start-maximized \