# Provide environmental variables from nix

**URL:** https://discourse.nixos.org/t/provide-environmental-variables-from-nix/3453
**Category:** Uncategorized
**Created:** [July 14, 2019, 8:02am UTC](https://discourse.nixos.org/t/provide-environmental-variables-from-nix/3453 "2019-07-14T08:02:43Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![danieldk](https://discourse.nixos.org/user_avatar/discourse.nixos.org/danieldk/32/31405_2.png) [@danieldk](https://discourse.nixos.org/u/danieldk)
#### Post date: [July 14, 2019, 9:05am UTC](https://discourse.nixos.org/t/provide-environmental-variables-from-nix/3453/3 "2019-07-14T09:05:28Z")

</div>

Adding a small example of a variable that points to something in the Nix store:

```nix
with import <nixpkgs> {};

stdenv.mkDerivation rec {
  name = "some-env";

  buildInputs = [
    boost
  ];

  BOOST_ROOT = "${boost}/lib";
}

```

```bash
$ nix-shell
$ echo $BOOST_ROOT
/nix/store/5w298gaixjkfs18w51p7y35v105rgdfw-boost-1.67.0/lib

```

---

_[View the full topic](https://discourse.nixos.org/t/provide-environmental-variables-from-nix/3453)._
