Nix (command): Difference between revisions

imported>Gdamjan
No edit summary
imported>Fricklerhandwerk
add notes on switching between nix-env and nix-profile
Line 29: Line 29:
</syntaxHighlight>
</syntaxHighlight>
and then run <code>sudo nixos-rebuild switch</code> as always.
and then run <code>sudo nixos-rebuild switch</code> as always.
== Switching between <code>nix-env</code> and <code>nix profile</code> ==
{{warning|Be careful when testing.
Once you have used <code>nix profile</code> you can no longer use <code>nix-env</code> without first deleting <code>/nix/var/nix/profiles/per-user/$USER/profile</code>}}
Once you installed a package with <code>nix profile</code>, you
get the following error message when using <code>nix-env</code>:
<syntaxHighlight lang=console>
$ nix-env -f '<nixpkgs>' -iA 'hello'
error: --- Error ----------------------------------------------------------------------------------------------------------------- nix-env
profile '/nix/var/nix/profiles/per-user/joerg/profile' is incompatible with 'nix-env'; please use 'nix profile' instead
</syntaxHighlight>
To migrate back to <code>nix-env</code> you can delete your current profile:
{{warning|This will delete packages that have been installed before, so you may want to back this information before running the command.}}
<syntaxHighlight lang=console>
$ rm -rf /nix/var/nix/profiles/per-user/$USER/profile
</syntaxHighlight>


[[Category:Nix]]
[[Category:Nix]]