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

How to combine shells #311

Open
zmrocze opened this issue May 17, 2024 · 2 comments
Open

How to combine shells #311

zmrocze opened this issue May 17, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@zmrocze
Copy link

zmrocze commented May 17, 2024

Hey,

how would i go about combining shells? I tried the below but it doesn't work, why? Should I use modules?

For example I'd like to do:

devshells = {
  default = {
    devshell = {
      name = "My main shell";
      packagesFrom = [
        config.devShells.haskell
        config.devShells.utils
      ];
    };
  };
  utils = {
    devshell.name = "My subproject shell";
    commands = [
      {
        name = "my-util";
        command = "${pkgs.utils}/bin/my-util";
      }
    ];
  };
}    

defining an utils shell with the devshell module and combining it with a classical derivation based shell config.devShells.haskell that for example is created by some library code and I don't define it by myself.
Or combine two or more shells of whatever flavor together, best getting information about conflicts.

In the example above, the resulting default shell indeed has all the commands coming from the haskell shell, but the my-util commad is missing from it. Why?

Given that devshells use module system, it's possible to share devshells by sharing modules. BUT I would like to understand why the above doesn't include my-utils inside shell? Together with #310 where I ask about the packages argument.

@zmrocze zmrocze added the enhancement New feature or request label May 17, 2024
@zmrocze
Copy link
Author

zmrocze commented May 17, 2024

PS: Ah, also, with traditional devShells I can use mergeShells and merge not only inputs but also shellHooks.

It would be cool to have a matching solution with devshells, so that it's matter of setting a single option instead of the two:

packagesFrom = [other-shell]
startup.sth = other-shell.shellHook;

What do you guys think?

@zmrocze
Copy link
Author

zmrocze commented May 17, 2024

PS: Merging by module import is not that straightforward, because on options like name there's always going to be conflicts.

So: how to combine shells?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant