Flakes: Difference between revisions

imported>Hypnosis2839
Basic project usage: simplify warning, clarify git-related warning, remove imperative command
imported>Hypnosis2839
m Basic project usage: clarify git warning
Line 58: Line 58:
{{warning | Files that are part of the flake will be copied to the world-readable nix store when the flake is evaluated; avoid putting unencrypted secrets in your flake.}}
{{warning | Files that are part of the flake will be copied to the world-readable nix store when the flake is evaluated; avoid putting unencrypted secrets in your flake.}}


In your repo, run <code>nix flake init</code> to generate the flake.nix file.
In your project, run <code>nix flake init</code> to generate the flake.nix file.


If you use <code>git</code>, ensure to <code>git add</code> any project files, because for flakes in git repos, only files in the working tree will be copied to the store.
For flakes in git repos, only files in the working tree will be copied to the store.
 
Therefore, if you use <code>git</code> for your flake, ensure to <code>git add</code> any project files after you first create them.


See also https://www.tweag.io/blog/2020-05-25-flakes/
See also https://www.tweag.io/blog/2020-05-25-flakes/