From 2e6f10dc857c95472f2d6c302e324a24efa05e78 Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Mon, 28 Dec 2020 18:48:41 -0700 Subject: [PATCH] Fix any-nix-shell breaking `nix-run` Simply apply the PR from haslersn/any-nix-shell#6 until it is merged upstream. --- overlays/any-nix-shell.nix | 6 ++ ...ix-run-is-now-nix-shell-semantically.patch | 58 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 overlays/any-nix-shell.nix create mode 100644 profiles/develop/zsh/patches/0001-nix-run-is-now-nix-shell-semantically.patch diff --git a/overlays/any-nix-shell.nix b/overlays/any-nix-shell.nix new file mode 100644 index 00000000..897bb555 --- /dev/null +++ b/overlays/any-nix-shell.nix @@ -0,0 +1,6 @@ +final: prev: { + any-nix-shell = prev.any-nix-shell.overrideAttrs + (o: { + patches = [ ../profiles/develop/zsh/patches/0001-nix-run-is-now-nix-shell-semantically.patch ]; + }); +} diff --git a/profiles/develop/zsh/patches/0001-nix-run-is-now-nix-shell-semantically.patch b/profiles/develop/zsh/patches/0001-nix-run-is-now-nix-shell-semantically.patch new file mode 100644 index 00000000..a0b7b918 --- /dev/null +++ b/profiles/develop/zsh/patches/0001-nix-run-is-now-nix-shell-semantically.patch @@ -0,0 +1,58 @@ +From d2418a9ba05402d969a63f0f2a460b0ed348806f Mon Sep 17 00:00:00 2001 +From: Timothy DeHerrera +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 +