# Flakes way of creating a FHS environment

**URL:** https://discourse.nixos.org/t/flakes-way-of-creating-a-fhs-environment/20821
**Category:** Uncategorized
**Created:** [August 7, 2022, 4:34pm UTC](https://discourse.nixos.org/t/flakes-way-of-creating-a-fhs-environment/20821 "2022-08-07T16:34:09Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![ericgundrum](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/e/e19adc/32.png) [@ericgundrum](https://discourse.nixos.org/u/ericgundrum)
#### Post date: [August 8, 2022, 7:31pm UTC](https://discourse.nixos.org/t/flakes-way-of-creating-a-fhs-environment/20821/2 "2022-08-08T19:31:34Z")

</div>

In the `outputs` section of your flake.nix. write something like `fhs_env = pkgs.buildFHSUserEnv {...};`. Then you can run it with `nix run .#fhs_env`. If your `runScript` is a shell, you’ll enter the shell where you can explore the environment to determine what to adjust. See the wiki page on [Flakes](https://nixos.wiki/wiki/Flakes) for details on the structure of `flake.nix`. Remember that `flake.nix` and `flake.lock` must be part of a git repo to use the flake.

---

_[View the full topic](https://discourse.nixos.org/t/flakes-way-of-creating-a-fhs-environment/20821)._
