# Layering environments and containerization

**URL:** https://discourse.flox.dev/t/layering-environments-and-containerization/877
**Category:** Feature Requests
**Created:** [March 31, 2024, 8:24am UTC](https://discourse.flox.dev/t/layering-environments-and-containerization/877 "2024-03-31T08:24:13Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![fst](https://avatars.discourse-cdn.com/v4/letter/f/c0e974/32.png) [@fst](https://discourse.flox.dev/u/fst)
#### Post date: [March 31, 2024, 8:24am UTC](https://discourse.flox.dev/t/layering-environments-and-containerization/877/1 "2024-03-31T08:24:13Z")

</div>

Hello!

Let me first state the I’m _extremely_ new to Flox so apologies if these features already exist or the issues are already addressed elsewhere. I didn’t find answers in the official documentation and I’m a newbie to everything Nix.

So far Flox is a great tool and I can see myself using it extensively in the future.

I love the idea of working with layered environments but I have two issues with them:

- I would like to be able to “link” layered envs:

Say I have a _pygen_ env and a _projectX_ env that I always plan to run “within” _pygen_, I would like a way to specify that _projectX_ always needs _pygen_, so when I activate _projectX_, flox automatically activates _pygen_ (ideally this should be transitive, too).

- What happens when I containerize _projectX_ that “depends” on _pygen_?

I suspect that only the packages inside _projectX_ get picked up, as there is no explicit dependency to _pygen_ but I may very well be mistaken.

- Another, different, possibility would be the ability to merge environments:

I do my work with the layered envs activating them by hand without any explicit dependency between them, but when i need to containerize my product, there is a Flox command that allows me to merge environments into one I can containerize.

Again, apologies if all this already exists/can be done and I simply haven’t found how yet.

have a nice day,  
Francesco

---

<div class="post-metadata">

### Author: ![ghudgins](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.flox.dev/ghudgins/32/588_2.png) [@ghudgins](https://discourse.flox.dev/u/ghudgins)
#### Post date: [April 1, 2024, 3:14pm UTC](https://discourse.flox.dev/t/layering-environments-and-containerization/877/2 "2024-04-01T15:14:15Z")

</div>

We currently don’t have a way of composing environments from other environments but this is something that we have on our plan. I logged an issue to collect feedback on this and to share the designs once they are available

> <https://github.com/flox/flox/issues/1251>
>
> \### Motivation
> 
> \*\*When\*\* I have a base environment defined in FloxHub or elsew…here on my machine
> \*\*And\*\* I want to guarantee that a project environment is based on the base environment
> \*\*I need\*\* to be able to define environments my project environments are based on
> \*\*So I can\*\* build similar projects with re-usable environments (instead of repeating myself)
> 
> This is a larger feature. Will use this issue as a catch-all for feedback 
> 
> \_Needs design\_

---

<div class="post-metadata">

### Author: ![fst](https://avatars.discourse-cdn.com/v4/letter/f/c0e974/32.png) [@fst](https://discourse.flox.dev/u/fst)
#### Post date: [April 2, 2024, 8:58am UTC](https://discourse.flox.dev/t/layering-environments-and-containerization/877/3 "2024-04-02T08:58:10Z")

</div>

Thank you! I’ll be following the discussion and development of the issue with interest.

ciao, Francesco
