Home Explore Blog Models CI



nix

1st chunk of `src/nix/profile.md`
567769c00ca147c44e9b44daa1b6373bdf6e7ac967b87bdc0000000100000442
R""(

# Description

`nix profile` allows you to create and manage *Nix profiles*. A Nix
profile is a set of packages that can be installed and upgraded
independently from each other. Nix profiles are versioned, allowing
them to be rolled back easily.

# Files

)""

#include "profiles.md.gen.hh"

R""(

### Profile compatibility

> **Warning**
>
> Once you have used [`nix profile`] you can no longer use [`nix-env`] without first deleting `$XDG_STATE_HOME/nix/profiles/profile`


Once you installed a package with [`nix profile`], you get the following error message when using [`nix-env`]:

```console
$ nix-env -f '<nixpkgs>' -iA 'hello'
error: nix-env
profile '/home/alice/.local/state/nix/profiles/profile' is incompatible with 'nix-env'; please use 'nix profile' instead
```

To migrate back to `nix-env` you can delete your current profile:

> **Warning**
>
> This will delete packages that have been installed before, so you may want to back up this information before running the command.

```console
 $ rm -rf "${XDG_STATE_HOME-$HOME/.local/state}/nix/profiles/profile"
```

)""

Title: Nix Profiles: Description and `nix-env` Incompatibility
Summary
This chunk describes Nix profiles as versioned, independently manageable sets of packages that allow for easy rollbacks, controlled by the `nix profile` command. It then highlights a critical compatibility issue: once `nix profile` has been used, `nix-env` can no longer be used for package management. Attempting to use `nix-env` will result in an error message. To revert to using `nix-env`, users must manually delete their current Nix profile directory (`$XDG_STATE_HOME/nix/profiles/profile`), with a warning that this action will remove all previously installed packages.