devshell icon indicating copy to clipboard operation
devshell copied to clipboard

How to combine shells

Open zmrocze opened this issue 9 months ago • 2 comments

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 avatar May 17 '24 18:05 zmrocze