Nix command: Difference between revisions
imported>Fricklerhandwerk nix -> Nix package manager |
imported>Gdamjan No edit summary |
||
Line 19: | Line 19: | ||
in <code>~/.config/nix/nix.conf</code>. | in <code>~/.config/nix/nix.conf</code>. | ||
On NixOS you can't edit <code>/etc/nix/nix.conf</code> directly, but you can enable this feature by editing <code>/etc/nixos/configuration.nix</code>: | |||
<syntaxHighlight lang=nix> | <syntaxHighlight lang=nix> | ||
# | # | ||
{ pkgs, ... }: { | { pkgs, ... }: { | ||
… | |||
nix.settings.experimental-features = [ "nix-command" ]; | |||
… | |||
} | } | ||
</syntaxHighlight> | </syntaxHighlight> | ||
and then run <code>sudo nixos-rebuild switch</code> as always. | |||
[[Category:Nix]] | [[Category:Nix]] |
Revision as of 23:02, 3 October 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 package manager 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
.
On NixOS you can't edit /etc/nix/nix.conf
directly, but you can enable this feature by editing /etc/nixos/configuration.nix
:
#
{ pkgs, ... }: {
…
nix.settings.experimental-features = [ "nix-command" ];
…
}
and then run sudo nixos-rebuild switch
as always.