Permanent nix-shell

Is it possible to configure / overlay a program / package such that it always launches as if it was started from within a nix-shell call?
I have tried both pkgs.symlinkJoin and regular overrides in combination with makeWrapper but they do not produce the desired results.

1 Like

You should say how the results weren’t matching your expectations.

But maybe try a nix shell shebang?

1 Like

The last time I asked the question I was more explicit and got no answers.
I tried condensing it down a little more, but maybe I went a little too far.

I am trying to use jetbrains clion IDE for rust development.
I already have a setup that works, running clion from within a nix-shell where the shell.nix file contains the setup from the nix wiki page about rust.
The thing I’d like to do now is to configure the clion command to always run “as if” it was executed from within that very shell environment. But whenever I do it behaves differently although I configured all environment variables and so on the same way the shell file does.

I guess in principle the question could also be applied to other commands ran from within a nix shell and it is not specific to what I am trying to accomplish.

I could probably just create an alias that references a shell definition that is at some static path, but that feels impure.

1 Like

I would like to have clion always execute in an environment that makes rust work.
Running it from inside a nix-shell with the rustup environment from the wiki (Rust - NixOS Wiki) works just fine, but I would like to make that setup permanent.
What I have tried is wrapping clion inside a pkgs.symlinkJoin with the same definitions and even passing them to wrapProgram but that does not seem to do anything. The environment variables are all there, but the rust plugin cannot detect them.
Here is what I have tried: naIon.nix · GitHub

Is there something I am missing, or is there a simpler way to accomplish this?