Provide environmental variables from nix

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

with import <nixpkgs> {};

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

  buildInputs = [
    boost
  ];

  BOOST_ROOT = "${boost}/lib";
}
$ nix-shell
$ echo $BOOST_ROOT
/nix/store/5w298gaixjkfs18w51p7y35v105rgdfw-boost-1.67.0/lib
8 Likes