Flakes: Difference between revisions

Sen (talk | contribs)
m Input schema: Fixed broken codeblock formatting at hyprland inputs example
Zetsu (talk | contribs)
m Minor edits to achieve more consistent formatting
Line 16: Line 16:


When using any <code>nix</code> command, add the following command-line options:
When using any <code>nix</code> command, add the following command-line options:
<syntaxHighlight lang=text>
<syntaxhighlight lang="shell">
  --experimental-features 'nix-command flakes'
  --experimental-features 'nix-command flakes'
</syntaxHighlight>
</syntaxhighlight>


====Enable flakes permanently in NixOS====
====Enable flakes permanently in NixOS====


Add the following to the [[Overview_of_the_NixOS_Linux_distribution#Declarative_Configuration system configuration | NixOS configuration]]:
Add the following to the [[Overview_of_the_NixOS_Linux_distribution#Declarative_Configuration system configuration |NixOS configuration]]:


<syntaxHighlight lang=nix>
<syntaxHighlight lang=nix>
Line 254: Line 254:
== Using nix flakes with NixOS ==
== Using nix flakes with NixOS ==


nixos-rebuild switch will read its configuration from <code>/etc/nixos/flake.nix</code> if it is present.
{{Ic|nixos-rebuild switch}} will read its configuration from <code>/etc/nixos/flake.nix</code> if it is present.


A basic nixos flake.nix could look like this:
A basic nixos flake.nix could look like this:
Line 293: Line 293:
</syntaxHighlight>
</syntaxHighlight>


nixos-rebuild also allows to specify different flake using the <code>--flake</code> flag (# is optional):
{{Ic|nixos-rebuild}} also allows to specify different flake using the <code>--flake</code> flag (# is optional):


<syntaxHighlight lang=console>
<syntaxHighlight lang=console>