Flake Utils: Difference between revisions
m add link |
m Fix grammar Tags: Mobile edit Mobile web edit Visual edit |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
{{Warning|using flake-utils is [https://ayats.org/blog/no-flake-utils not recommended] | {{Warning|using flake-utils is [https://ayats.org/blog/no-flake-utils not recommended]; if you want to use a flake framework, use [[Flake Parts]] instead.}} | ||
[https://github.com/numtide/flake-utils flake-utils] is a collection of pure Nix functions that don't depend on [[Nixpkgs]], and that are useful in the context of writing other [[Flakes|Nix Flakes]]. | [https://github.com/numtide/flake-utils flake-utils] is a collection of pure Nix functions that don't depend on [[Nixpkgs]], and that are useful in the context of writing other [[Flakes|Nix Flakes]]. | ||
| Line 5: | Line 5: | ||
= Defining a flake for multiple architectures = | = Defining a flake for multiple architectures = | ||
Flakes force you specify a program for each supported architecture. You may want to 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 | Flakes force you specify a program for each supported architecture. You may want to 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 your flake as follows: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
| Line 53: | Line 53: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== See also == | |||
* [https://nixcademy.com/posts/1000-instances-of-flake-utils/ 1000 Instances of flake-utils, Nixcademy] | |||
[[Category:Flakes]] | [[Category:Flakes]] | ||