Skip to content

Commit

Permalink
nix run is now nix shell semantically
Browse files Browse the repository at this point in the history
  • Loading branch information
nrdxp committed Dec 29, 2020
1 parent 8c857d4 commit d2418a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions bin/.any-nix-run-wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fns () {
pos=$((pos-1))
elif [[ $arg == -* ]]; then
if [[ $arg == -c ]] || [[ $arg == --command ]]; then
command nix run "$@"
command nix shell "$@"
return
elif [[ $arg == --arg ]] || [[ $arg == --argstr ]]; then
pos=2
Expand All @@ -27,6 +27,6 @@ fns () {
if [[ -n $name ]] && [[ $name != shell ]]; then
pkgs+=" "$name
fi
env ANY_NIX_SHELL_PKGS="$pkgs" IN_NIX_RUN=1 nix run "$@" --command $which_shell
env ANY_NIX_SHELL_PKGS="$pkgs" IN_NIX_RUN=1 nix shell "$@" --command $which_shell
}
fns "$@"
fns "$@"
4 changes: 2 additions & 2 deletions bin/any-nix-shell
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ end
# Overwrite the nix command
function nix
if test \$argv[1] = run
if test \$argv[1] = shell
set argv[1] fish
$(which .any-nix-run-wrapper) \$argv
else
Expand Down Expand Up @@ -51,7 +51,7 @@ function nix-shell () {
# Overwrite the nix command
function nix () {
if [[ \$1 == run ]]; then
if [[ \$1 == shell ]]; then
shift
$(which .any-nix-run-wrapper) zsh "\$@"
else
Expand Down

0 comments on commit d2418a9

Please sign in to comment.