devenv
devenv copied to clipboard
Can't use more than one shell with flakes
Describe the bug
I use nix flakes and I cannot use more than one shell because devenv now "temporarily" requires adding devenv-up = self.devShells.${system}.default.config.procfileScript; attribute to packages. I know I can replace default with any other shell but it breaks any composability.
To reproduce Spin up a devenv using the fake setup from the example and try to add another devshell.
Version 1.0.4 with flakes
The UX around this is not great, but here's how to create multiple shells with plain flakes:
# Assuming flake-utils here to skip setting system
{
packages = {
# The "default" shell
devenv-up = self.devShells.${system}.default.config.procfileScript;
# Another shell. The pattern is: <shellName>-devenv-up
cross-devenv-up = self.devShells.${system}.cross.config.procfileScript;
};
devShells = {
default = devenv.lib.mkShell { ... };
cross = devenv.lib.mkShell { ... };
};
}
If you're using flake-parts, the devenv-up packages are created for you.
What does seem broken in both plain flakes and flake-parts is launching processes with devenv up inside the shell.
For plain flakes, config._module.args.name is not a thing AFAIKT, so we always fall back to launching the "default" package.
For flake-parts, the devenv flake-integration script is not sourced in the shell.