title: How to record a reproducible profile in nix (especially from nix-env)?
body: <p>So, finally starting to get a stable nix environment that I can basically do all of my development in. Hooray! </p>
  
  <p>Now I want to make it reproducible, as in <a href="https://yarnpkg.com/lang/en/docs/yarn-lock/" rel="nofollow noreferrer">yarn.lock</a> (for those familiar with npm/yarn in javascript land) or <a href="https://github.com/pypa/pipfile" rel="nofollow noreferrer">Pipfile.lock</a> (very similar for Python).</p>
  
  <p>Basically the idea is that I would have a way to generate a similar lock file whenever I run <code>nix-env -if my-env.nix</code>, or after running this command, if that is how it would work. From this lock file, I could then exactly restore my nix profile, down to the exact versions of dependencies and sub-dependencies of the installed profile. This could be checked into git or whatever after testing out new improvements, and so a record of the environment would be maintained.</p>
  
  <p>It seems to me this would be one of the most obvious use cases for Nix, and one of the major advantages over just using Docker (though the two aren't mutually exclusive), so I apologize if I've missed some relevant documentation.</p>