aboutsummaryrefslogtreecommitdiffstats
path: root/modules/terminal/zsh/nix-aliases.sh
blob: 0a2f453a258dfd40150fd80e1c4388b380b96253 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
nix-shell() {
  for arg in "$@"; do
    if [[ "$arg" == "--run" || "$arg" == "--command" ]]; then
      command nix-shell "$@"
      return
    fi
  done

  command nix-shell "$@" --run "$SHELL"
}

nix() {
  if [[ "$1" == "develop" ]]; then
    local args=("${@:2}")

    for arg in "${args[@]}"; do
      if [[ "$arg" == "-c" || "$arg" == "--command" ]]; then
        command nix "$@"
        return
      fi
    done

    command nix develop "${args[@]}" -c "$SHELL"
  else
    command nix "$@"
  fi
}