Search code examples
shellconfigurationdevelopment-environmentnixos

Configure nix-shell to use a shell other than Bash?


I'm on NixOS 15 and nix-shell v1.10. I use Zsh as my main shell now, and would like to use it in conjuction with Oh-My-Zsh within the nix-shell as well when I'm working in development environments built by a Nix expression.

If it helps, here is one of the Nix environments I have set up for a Rails project:

with import <nixpkgs> {}; {
  cannyFreeRadicalEnv = stdenv.mkDerivation rec {
    name = "canny-free-radical-env";
    version = "0.1";
    src = ./.;
    buildInputs = [
        stdenv
        ruby_2_2_2
        bundler_HEAD
        zlib
        postgresql94
        sqlite
    ];
  };
}

** Edit **

Running the command this way does not indicate in the CLI prompt that I'm in the nix-shell. Is there an easy way to detect this so that I can script it up quickly in my zshrc?


Solution

  • there is PR #545 opened recently which will address this