title: nix-shell: how to specify a custom environment variable?
body: <p>I'm learning about nixos and nix expressions. In a project folder I created a shell.nix and I when I run <code>nix-shell</code> I want it to preset an environment variable for me.
  For example to set the PGDATA env var.</p>
  
  <p>I know there are several ways to write nix expression files (I'm not yet used to most of them). Here is my sample:</p>
  
  <p><em>shell.nix</em></p>
  
  <pre><code>let 
    pkgs = import &lt;nixpkgs&gt; {};
    name = "test";
  in pkgs.myEnvFun {
    buildInputs = [
      pkgs.python
      pkgs.libxml2
    ];
    inherit name;
    extraCmds = ''
      export TEST="ABC"
    '';
   }
  </code></pre>