any-nix-shell
any-nix-shell copied to clipboard
`nix develop` (flake) support ?
Hello,
I'm switching my projects and use more and more flakes.
When I do nix develop
, it starts a bash shell instead of continue to use my current shell on fish.
Do you think it's possible to use any-nix-shell
so it works with nix develop
?
I guess this line needs to be modified: https://github.com/haslersn/any-nix-shell/blob/master/bin/any-nix-shell#L15
This indeed fixes it for fish:
--- 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] = shell
+ if test \$argv[1] = shell || test \$argv[1] = develop
set argv[1] fish
$(which .any-nix-wrapper) \$argv
else
The zsh code would need a similar modification.
It displays "[unknown environment]" at the right of the shell prompt though.
How about making a pull request ?
.any-nix-wrapper
would also need an update, otherwise it seems nix develop
gets aliased to nix shell
.
@sbourdeauducq is right. I'm working on it.
nix develop
and the old nix run
(Nix 2.0 - 2.3) have very different command line options. Therefore, supporting nix develop
would require some larger changes.
@drupol It seems in Nix 2.4 they reintroduced nix shell
, which uses the user's default shell, so any-nix-shell is not required. Can you use nix shell
instead of nix develop
? It seems the Nix developers deliberately made it so that nix develop
uses bash, in order to make debugging builds possible.
Can you use
nix shell
instead ofnix develop
?
Unfortunately nix shell
means using pkgs.buildEnv
and not pkgs.mkShell
. This means you cannot set environment variables in the shell from the flake, and also it appears that some programs such as llvm-config
(or build tools using it) misbehave in the forest of symlinks created by pkgs.buildEnv
.
It seems the Nix developers deliberately made it so that
nix develop
uses bash, in order to make debugging builds possible.
Ah yes - that would make sense...
On my side, I found a workaround: nix develop --command fish
FYI nix-your-shell
has support for nix-develop
.
Unable to build it, doesn't look like the maintainer is taking care of the it anymore.
You can get the latest release from Nixpkgs:
λ nix build nixpkgs#nix-your-shell
λ ./result/bin/nix-your-shell --version
nix-your-shell 1.1.1