Skip to content
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

Can't use more than one shell with flakes #1172

Open
wokalski opened this issue Apr 27, 2024 · 2 comments
Open

Can't use more than one shell with flakes #1172

wokalski opened this issue Apr 27, 2024 · 2 comments
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@wokalski
Copy link

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

@wokalski wokalski added the bug Something isn't working label Apr 27, 2024
@sandydoo
Copy link
Member

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.

@sandydoo sandydoo added documentation Improvements or additions to documentation question Further information is requested and removed bug Something isn't working labels Apr 29, 2024
@sandydoo
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants