Skip to content

How to combine shells #311

Open
Open

Description

@zmrocze

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.

Activity

  1. zmrocze commented on May 17, 2024

    @zmrocze
    Author

    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?

  2. zmrocze commented on May 17, 2024

    @zmrocze
    Author

    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?

  3. micharied commented on Jan 8, 2025

    @micharied

    Hey are there any news on this. I would love to combine my shell created by haskellPackages.shellFor with devshells

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions