Nix command: Difference between revisions

From NixOS Wiki
imported>Fricklerhandwerk
remove category: Software
imported>Fricklerhandwerk
add link to manual
Line 1: Line 1:
This article is about the new <code>nix</code> command and all of its subcommands. The new <code>nix</code> command is intended to unify many different nix utilities that exist currently as many separate commands, eg. <code>nix-build</code>, <code>nix-shell</code>, etc.  
This article is about the new <code>nix</code> command and all of its subcommands. The new <code>nix</code> command is intended to unify many different nix utilities that exist currently as many separate commands, eg. <code>nix-build</code>, <code>nix-shell</code>, etc.  


This article is written for nix 2.4 or newer. Older nix versions might have different commands.
See the [https://nixos.org/manual/nix/stable/command-ref/experimental-commands.html Nix manual] for a complete reference.


== Enabling the nix command ==
== Enabling the nix command ==

Revision as of 08:12, 4 August 2022

This article is about the new nix command and all of its subcommands. The new nix command is intended to unify many different nix utilities that exist currently as many separate commands, eg. nix-build, nix-shell, etc.

See the Nix manual for a complete reference.

Enabling the nix command

In nix 2.4 the nix command must be enabled explicitly set. You can do this in a few different ways.

For an individual invocation, eg.

nix --experimental-features nix-command build ...

Or by setting a user-specific configuration,

# ~/.config/nix/nix.conf
experimental-features = nix-command

in ~/.config/nix/nix.conf.

Or system-wide with

# /etc/nix/nix.conf
{ pkgs, ... }: {
   nix.extraOptions = ''
      experimental-features = nix-command
   '';
}

in /etc/nix/nix.conf on NixOS.