Flakes: Difference between revisions
imported>Kreativmonkey change nixpkgs url to current nixos release |
imported>Hypnosis2839 →Enable flakes: prefer declarative config, fix formatting, add note about HM |
||
| Line 17: | Line 17: | ||
== Enable flakes == | == Enable flakes == | ||
Flakes | Flakes were introduced with Nix 2.4 ([https://nixos.org/manual/nix/unstable/release-notes/rl-2.4.html release notes]). | ||
===Temporary=== | ===Temporary=== | ||
Add <code>--experimental-features 'nix-command flakes'</code> when | Add <code>--experimental-features 'nix-command flakes'</code> when using any <code>nix3</code> commands. | ||
=== Permanent === | === Permanent === | ||
==== NixOS ==== | |||
Add the following to your system configuration: | |||
<syntaxHighlight lang= | <syntaxHighlight lang=nix> | ||
experimental-features = nix-command flakes | nix.settings.experimental-features = [ "nix-command" "flakes" ]; | ||
</syntaxHighlight> | </syntaxHighlight> | ||
==== Other Distros: With Home-Manager ==== | |||
If you use HM, add the following to your home-manager config: | |||
<syntaxHighlight lang= | <syntaxHighlight lang=nix> | ||
nix = { | |||
package = pkgs.nix; | |||
settings.experimental-features = [ "nix-command" "flakes" ]; | |||
}; | |||
</syntaxHighlight> | </syntaxHighlight> | ||
===== Other Distros: Without Home-Manager ===== | |||
{{ note | Flakes are already enabled if you installed Nix using the [https://github.com/DeterminateSystems/nix-installer Determinate Installer]. }} | |||
Add the following to <code>~/.config/nix/nix.conf</code> or <code>/etc/nix/nix.conf</code>: | |||
<syntaxHighlight lang= | <syntaxHighlight lang=text> | ||
experimental-features = nix-command flakes | |||
</syntaxHighlight> | </syntaxHighlight> | ||