Direnv: Difference between revisions

Pigs (talk | contribs)
m move nixos content under nixos section
Toastal (talk | contribs)
Add note on Direnv being a personalized file to encourage projects to stop committing files that mess with contributor workflows.
 
Line 44: Line 44:


The NixOS module uses <code>nix-direnv</code> by default when Direnv is enabled. This behavior can be overridden by setting the {{nixos:option|programs.direnv.nix-direnv.enable}} option.
The NixOS module uses <code>nix-direnv</code> by default when Direnv is enabled. This behavior can be overridden by setting the {{nixos:option|programs.direnv.nix-direnv.enable}} option.
== User Customization & Repositories ==
Direnv is meant to be used as a personalized environment file so each user can set any necessary environment variables and/or run some setup scripts. As every user can have different environment needs (such as changing ports, location of <code>$TMPDIR</code>, project-specific VCS/PGP/SSH credentials) it’s recommended <strong>not</strong> to track or commit the <code>.envrc</code> so users may make adjustments for themselves. In fact, it’s best to add both to your ignorefile
<syntaxHighlight>
.direnv
.envrc
</syntaxHighlight>
to avoid accidentally checking in your personal setup (as seen in Nixpkgs’s repository). If you have a complex <code>.envrc</code> you wish to share, create a <code>.envrc.example</code> file that users can copy, symlink, or source depending on what works for them.


== Troubleshooting ==
== Troubleshooting ==