diff --git a/README.md b/README.md index 2fac25b..4573153 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # any-nix-shell -`fish` and `zsh` support for the `nix run` and `nix-shell` environments of the Nix package manager. +`fish` and `zsh` support for the `nix shell` and `nix-shell` environments of the Nix package manager. Features: - * When entering a `nix run` or `nix-shell` environment, the shell stays the same. + * When entering a `nix shell` or `nix-shell` environment, the shell stays the same. * Inside those environments, your prompt prints the loaded packages to the right. * Alternatively, print that information by executing: `nix-shell-info` * `nix-shell --command` or the like still execute inside `bash`, such that scripts don't break. @@ -81,4 +81,4 @@ The `any-nix-shell` command (which is used for enabling the plugin in a specific | Flag | Description | | - | - | -| `--info-right` | While in a `nix run` or `nix-shell` environment, display information about the loaded packages at the right. | +| `--info-right` | While in a `nix shell` or `nix-shell` environment, display information about the loaded packages at the right. | diff --git a/bin/.any-nix-run-wrapper b/bin/.any-nix-wrapper similarity index 86% rename from bin/.any-nix-run-wrapper rename to bin/.any-nix-wrapper index 618ff14..db97319 100755 --- a/bin/.any-nix-run-wrapper +++ b/bin/.any-nix-wrapper @@ -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 @@ -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 "$@" \ No newline at end of file +fns "$@" diff --git a/bin/any-nix-shell b/bin/any-nix-shell index c8488fb..651cd3d 100755 --- a/bin/any-nix-shell +++ b/bin/any-nix-shell @@ -12,9 +12,9 @@ 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 + $(which .any-nix-wrapper) \$argv else command nix \$argv end @@ -51,9 +51,9 @@ function nix-shell () { # Overwrite the nix command function nix () { - if [[ \$1 == run ]]; then + if [[ \$1 == shell ]]; then shift - $(which .any-nix-run-wrapper) zsh "\$@" + $(which .any-nix-wrapper) zsh "\$@" else command nix "\$@" fi