Is it possible to import just a subset of packages from one environment to another?

I think that the answer is that, in order to do this, I need to know on which channel(s) those packages have been published then install them to the other environment.

So maybe the question comes down to: for a given environment is it possible to get the channel URL that was used for a given installed package?

Hi Eric,
It’s not currently possible to filter packages from one environment and add them to another environment. One could probably script this.
However, like you intuited, you could look up the channel for those packages with flox list which gives you the <stability>.<channel>.<package> triple and should be sufficient to fetch the package you want via flox install.

Let me know if that works or if I’ve misunderstood your query.
Thanks!

That’s indeed what I ended up doing but this can only work if I know the URL of the channel where the package is published. Most of the time it would be nixpkgs or flox but in the case of a channel like etorreborre there is not way through the command line to know how to subscribe to that channel. It would be good to make this information accessible, for example in the flox history command where we could see not only that a package was installed but also the full URL for the channel that was used.

I just noticed that we forgot to append to this thread - very sorry. We were in a bit of a heads down stage for the 7 Feb open source launch!

thank you @etorreborre for the suggestion. We have put this on our list of potential future enhancements, either via the CLI and/or the SaaS interface(s) so it isn’t forgotten. :slight_smile:

1 Like

Hi Eric,

I just wanted to add one other option which is to flox export -e owner1/name1 | flox import -e owner2/name2 and then remove the packages you don’t need. That will preserve the locks and duplicate the exact packages as found in the original environment.

Hope this helps!

Follow up: when removing packages from the target environment use the flox remove command rather than flox edit because the latter will perform an implicit upgrade.

1 Like