Flakes, multiple devShells in one project

I have a project where I have a regular devShell and I want to have another one (in my case, it uses musl build of deps packages).

Is there a way to declare two shells so that I can switch between them conveniently with nix develop, in direnv and etc

Thanks!

1 Like

You can define as many devShells as you want indeed.

Nix code example:

# This is a excerpt of a very basic flake.nix file, without using any Flake framework
devShells = {
  x86_64-linux = {
    python = pkgs.mkShell {
        packages = [
             pkgs.python3
        ];
    };
    php = pkgs.mkShell {
        packages = [
             pkgs.php
        ];
    };

  };
};

Then, to use them, do:

nix develop .#python

or

nix develop .#php
1 Like