-
Notifications
You must be signed in to change notification settings - Fork 358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate a bin folder inside .devenv #167
Comments
I think we can now just symlink |
Should I make this as integration module? Because it's like a "shim" for editors which don't have proper direnv integration |
We can do it by default in |
I don't think symlinking the profile is going to be enough in most cases. It might work for PHP, but it's not going to work for gcc/clang or any language that needs to compile and link using those toolchains. They depend on proper environment setup (e.g. |
I quickly hacked together a PoC of this yesterday (plain nix flakes, not devenv) pkgs.writeShellScriptBin "wrap" ''
rm -rf .wrap
mkdir -p .wrap/bin
nix print-dev-env > .wrap/devshell.sh
path=$(env -i ${pkgs.bash}/bin/bash -c "source .wrap/devshell.sh && echo \$PATH")
for path in $(${pkgs.findutils}/bin/find ''${path//:/ } -maxdepth 1 -executable 2> /dev/null); do
if [[ "$path" == *coreutils* ]]; then continue; fi
binary=$(basename "$path")
echo '#!${pkgs.bash}/bin/bash' > ".wrap/bin/$binary"
echo 'source "$(dirname -- "''${BASH_SOURCE[0]}")/../devshell.sh"' >> ".wrap/bin/$binary"
echo "exec $path" '"$@"' >> ".wrap/bin/$binary"
chmod +x ".wrap/bin/$binary"
done
'' This generates wrapper binaries like this: #!/nix/store/x380x9d7gqh4ig9h50a7wx08p0s6622f-bash-5.1-p16/bin/bash
source "$(dirname -- "${BASH_SOURCE[0]}")/../devshell.sh"
exec /nix/store/rnjmcss5x5mki8qj2wg76fi082jcvb5z-rust-toolchain/bin/cargo "$@" I tested it with vscode and rust and was a bit disappointed to find out that the rust-analyzer vscode extension has a lot of the toolchain discovery logic in the extension itself, where the shell environment variables are not available. For example it isn't aware of FWIW, a lot of these issues are avoidable by joining all packages into a single prefix tree (/{bin,lib,include}). The |
@szlend I guess this would definitively make sense to have in some kind of "integration module" as it's much more complex than "just" having a symlink. Or what do you think @domenkozar :) |
All Jetbrains IDEs needs an absolute path where the executables are living.
It would be nice if we would symlink php to
.devenv/bin/php
. So you can configure your IDE file path to that directory.Of course when the package gets updated we update it there too.
A little bit like the
/run/current-system/sw
The text was updated successfully, but these errors were encountered: