Aggregate several Python Envs within a BuildEnv

Hello all

I want to build single workspace environment for a project, where various Python tools are used. For now I have to build different packages (one for each Python tool), but I’m hoping you have some tricks or good ideas that could help me :slight_smile:

Roughly my flake.nix so far is:

#flake.nix
inputs = { nixpkgs };
outputs = { self, nixpkgs, ...}:
  let
    first_pyenv = nixpkgs.python311.withPackages (ps: [ ps.jsonschema ps.tkinter ]);
    second_pyenv = nixpkgs.python311.withPackages (ps: [ ps.requests ps.tkinter ]);
  in
    first_package = buildEnv {
        name = "First_Package";
        paths = [ first_pyenv nixpkgs.curl ];
    };
    second_package = buildEnv {
        name = "Second_Package";
        paths = [ second_pyenv nixpkgs.wget];
    };

I want to aggregate (buildEnv) both first_pyenv and second_pyenv into a single “project_workspace” package that would contain my both python envs and misc tools, but by doing so I get some complains when building aggregation that there are some conflicting files (of course the /bin/python is in both pyenvs).

Am I attempting something too exotic ? Are you aware of some workarounds ?
One thing I think at, is there a way to “rename” the python interpreters (ex: from /bin/python to /bin/first_pyenv_python) so that the aggregation won’t conflict ?

Thanks for any input or idea