Skip to content

Commit

Permalink
Add support for the 'nix develop' command (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
calebstewart authored Jul 20, 2024
1 parent 2537e5c commit e61713d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bin/.any-nix-wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fns () {
pos=0

# `nix run` only launched a shell from Nix 2.0.* to 2.3.*
if nix --version | grep -vq ' 2\.[0-3][^0-9]'; then
if [[ "$subcommand" == "run" ]] && nix --version | grep -vq ' 2\.[0-3][^0-9]'; then
exec nix "$subcommand" "$@"
fi

Expand Down
6 changes: 3 additions & 3 deletions bin/any-nix-shell
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ aliases["nix-shell"] = "@(\$(which .any-nix-shell-wrapper)) xonsh @(\$args)"
# Overwrite the nix command
def __nix(args):
if args and args[0] == "run":
if args and ( args[0] == "run" or args[0] == "develop" ):
@(\$(which .any-nix-wrapper)) xonsh @(args)
else:
@(\$(which -s nix)) @(args)
Expand Down Expand Up @@ -44,7 +44,7 @@ end
# Overwrite the nix command
function nix
if test \$argv[1] = run
if test \$argv[1] = run or test \$argv[1] = develop
$(which .any-nix-wrapper) fish \$argv
else
command nix \$argv
Expand Down Expand Up @@ -82,7 +82,7 @@ function nix-shell () {
# Overwrite the nix command
function nix () {
if [[ "\$1" == "run" ]]; then
if [[ "\$1" == "run" ]] || [[ "\$1" == "develop" ]]; then
$(which .any-nix-wrapper) zsh "\$@"
else
command nix "\$@"
Expand Down

0 comments on commit e61713d

Please sign in to comment.