2e6f10dc85
Simply apply the PR from haslersn/any-nix-shell#6 until it is merged upstream.
59 lines
1.7 KiB
Diff
59 lines
1.7 KiB
Diff
From d2418a9ba05402d969a63f0f2a460b0ed348806f Mon Sep 17 00:00:00 2001
|
|
From: Timothy DeHerrera <tim.deh@pm.me>
|
|
Date: Mon, 28 Dec 2020 18:35:44 -0700
|
|
Subject: [PATCH 1/2] `nix run` is now `nix shell` semantically
|
|
|
|
---
|
|
bin/.any-nix-run-wrapper | 6 +++---
|
|
bin/any-nix-shell | 4 ++--
|
|
2 files changed, 5 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/bin/.any-nix-run-wrapper b/bin/.any-nix-run-wrapper
|
|
index 618ff14..db97319 100755
|
|
--- a/bin/.any-nix-run-wrapper
|
|
+++ b/bin/.any-nix-run-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..6af6e23 100755
|
|
--- a/bin/any-nix-shell
|
|
+++ b/bin/any-nix-shell
|
|
@@ -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
|
|
@@ -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
|
|
--
|
|
2.29.2
|
|
|