Flakes: Difference between revisions

No edit summary
No edit summary
Line 100: Line 100:


</translate>
</translate>
<syntaxHighlight lang=text>
<syntaxHighlight lang=text>
nix flake init
nix flake init
</syntaxHighlight>
</syntaxHighlight>
<translate>
<translate>


Line 110: Line 112:


</translate>
</translate>
<syntaxHighlight lang=nix>
<syntaxHighlight lang=nix>
{
{
Line 131: Line 134:


As you can see, it forces you to specify a program for each supported architecture. To avoid this, third-parties projects like flake-utils or flake.parts automatically provide code to avoid this boilerplate. Moreover, in some cases, you may want to also provide an architecture and nixpkgs-independent overlay, allowing for instance the users of the flake to install the program in their system while using their own version of nixpkgs (anything inside <code>packages</code> will always pin all libraries to a fixed version, unless you use <code>yourflake.inputs.nixpkgs.follows = "nixpkgs";</code>). To avoid re-defining the program multiple times (once in the overlay, once for each architecture etc), you can instead write you flake as follows:
As you can see, it forces you to specify a program for each supported architecture. To avoid this, third-parties projects like flake-utils or flake.parts automatically provide code to avoid this boilerplate. Moreover, in some cases, you may want to also provide an architecture and nixpkgs-independent overlay, allowing for instance the users of the flake to install the program in their system while using their own version of nixpkgs (anything inside <code>packages</code> will always pin all libraries to a fixed version, unless you use <code>yourflake.inputs.nixpkgs.follows = "nixpkgs";</code>). To avoid re-defining the program multiple times (once in the overlay, once for each architecture etc), you can instead write you flake as follows:
</translate>
</translate>