.\" -*- mode: troff; coding: utf-8 -*- .TH "nix3-profile" "1" "" .PP \fBWarning\fR: This program is \fBexperimental\fR and its interface is subject to change. .SH Name \fCnix profile\fR - manage Nix profiles .SH Synopsis \fCnix profile\fR [\fIoption\fR\[u2026]] \fIsubcommand\fR .PP where \fIsubcommand\fR is one of the following: .IP "\(bu" 2 \fB\fCnix profile diff-closures\fR\fR (\fI./nix3-profile-diff-closures.md\fR) - show the closure difference between each version of a profile .if n \ .sp -1 .if t \ .sp -0.25v .IP "\(bu" 2 \fB\fCnix profile history\fR\fR (\fI./nix3-profile-history.md\fR) - show all versions of a profile .if n \ .sp -1 .if t \ .sp -0.25v .IP "\(bu" 2 \fB\fCnix profile install\fR\fR (\fI./nix3-profile-install.md\fR) - install a package into a profile .if n \ .sp -1 .if t \ .sp -0.25v .IP "\(bu" 2 \fB\fCnix profile list\fR\fR (\fI./nix3-profile-list.md\fR) - list installed packages .if n \ .sp -1 .if t \ .sp -0.25v .IP "\(bu" 2 \fB\fCnix profile remove\fR\fR (\fI./nix3-profile-remove.md\fR) - remove packages from a profile .if n \ .sp -1 .if t \ .sp -0.25v .IP "\(bu" 2 \fB\fCnix profile rollback\fR\fR (\fI./nix3-profile-rollback.md\fR) - roll back to the previous version or a specified version of a profile .if n \ .sp -1 .if t \ .sp -0.25v .IP "\(bu" 2 \fB\fCnix profile upgrade\fR\fR (\fI./nix3-profile-upgrade.md\fR) - upgrade packages using their most recent flake .if n \ .sp -1 .if t \ .sp -0.25v .IP "\(bu" 2 \fB\fCnix profile wipe-history\fR\fR (\fI./nix3-profile-wipe-history.md\fR) - delete non-current versions of a profile .SH Description \fCnix profile\fR allows you to create and manage \fINix profiles\fR. 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. .SH Default profile The default profile used by \fCnix profile\fR is \fC$HOME/.nix-profile\fR, which, if it does not exist, is created as a symlink to \fC/nix/var/nix/profiles/per-user/default\fR if Nix is invoked by the \fCroot\fR user, or \fC/nix/var/nix/profiles/per-user/\fR\fIusername\fR otherwise. .PP You can specify another profile location using \fC--profile\fR \fIpath\fR. .SH Filesystem layout Profiles are versioned as follows. When using profile \fIpath\fR, \fIpath\fR is a symlink to \fIpath\fR\fC-\fR\fIN\fR, where \fIN\fR is the current \fIversion\fR of the profile. In turn, \fIpath\fR\fC-\fR\fIN\fR is a symlink to a path in the Nix store. For example: .LP .EX $ ls -l /nix/var/nix/profiles/per-user/alice/profile* lrwxrwxrwx 1 alice users 14 Nov 25 14:35 /nix/var/nix/profiles/per-user/alice/profile -> profile-7-link lrwxrwxrwx 1 alice users 51 Oct 28 16:18 /nix/var/nix/profiles/per-user/alice/profile-5-link -> /nix/store/q69xad13ghpf7ir87h0b2gd28lafjj1j-profile lrwxrwxrwx 1 alice users 51 Oct 29 13:20 /nix/var/nix/profiles/per-user/alice/profile-6-link -> /nix/store/6bvhpysd7vwz7k3b0pndn7ifi5xr32dg-profile lrwxrwxrwx 1 alice users 51 Nov 25 14:35 /nix/var/nix/profiles/per-user/alice/profile-7-link -> /nix/store/mp0x6xnsg0b8qhswy6riqvimai4gm677-profile .EE .PP Each of these symlinks is a root for the Nix garbage collector. .PP The contents of the store path corresponding to each version of the profile is a tree of symlinks to the files of the installed packages, e.g. .LP .EX $ ll -R /nix/var/nix/profiles/per-user/eelco/profile-7-link/ /nix/var/nix/profiles/per-user/eelco/profile-7-link/: total 20 dr-xr-xr-x 2 root root 4096 Jan 1 1970 bin -r--r--r-- 2 root root 1402 Jan 1 1970 manifest.json dr-xr-xr-x 4 root root 4096 Jan 1 1970 share /nix/var/nix/profiles/per-user/eelco/profile-7-link/bin: total 20 lrwxrwxrwx 5 root root 79 Jan 1 1970 chromium -> /nix/store/ijm5k0zqisvkdwjkc77mb9qzb35xfi4m-chromium-86.0.4240.111/bin/chromium lrwxrwxrwx 7 root root 87 Jan 1 1970 spotify -> /nix/store/w9182874m1bl56smps3m5zjj36jhp3rn-spotify-1.1.26.501.gbe11e53b-15/bin/spotify lrwxrwxrwx 3 root root 79 Jan 1 1970 zoom-us -> /nix/store/wbhg2ga8f3h87s9h5k0slxk0m81m4cxl-zoom-us-5.3.469451.0927/bin/zoom-us /nix/var/nix/profiles/per-user/eelco/profile-7-link/share/applications: total 12 lrwxrwxrwx 4 root root 120 Jan 1 1970 chromium-browser.desktop -> /nix/store/4cf803y4vzfm3gyk3vzhzb2327v0kl8a-chromium-unwrapped-86.0.4240.111/share/applications/chromium-browser.desktop lrwxrwxrwx 7 root root 110 Jan 1 1970 spotify.desktop -> /nix/store/w9182874m1bl56smps3m5zjj36jhp3rn-spotify-1.1.26.501.gbe11e53b-15/share/applications/spotify.desktop lrwxrwxrwx 3 root root 107 Jan 1 1970 us.zoom.Zoom.desktop -> /nix/store/wbhg2ga8f3h87s9h5k0slxk0m81m4cxl-zoom-us-5.3.469451.0927/share/applications/us.zoom.Zoom.desktop … .EE .PP The file \fCmanifest.json\fR records the provenance of the packages that are installed in this version of the profile. It looks like this: .LP .EX { \(dqversion\(dq: 1, \(dqelements\(dq: [ { \(dqactive\(dq: true, \(dqattrPath\(dq: \(dqlegacyPackages.x86_64-linux.zoom-us\(dq, \(dqoriginalUrl\(dq: \(dqflake:nixpkgs\(dq, \(dqstorePaths\(dq: [ \(dq/nix/store/wbhg2ga8f3h87s9h5k0slxk0m81m4cxl-zoom-us-5.3.469451.0927\(dq ], \(dquri\(dq: \(dqgithub:NixOS/nixpkgs/13d0c311e3ae923a00f734b43fd1d35b47d8943a\(dq }, … ] } .EE .PP Each object in the array \fCelements\fR denotes an installed package and has the following fields: .IP "\(bu" 2 \fCoriginalUrl\fR: The \fBflake reference\fR (\fI./nix3-flake.md\fR) specified by the user at the time of installation (e.g. \fCnixpkgs\fR). This is also the flake reference that will be used by \fCnix profile upgrade\fR. .IP "\(bu" 2 \fCuri\fR: The immutable flake reference to which \fCoriginalUrl\fR resolved. .IP "\(bu" 2 \fCattrPath\fR: The flake output attribute that provided this package. Note that this is not necessarily the attribute that the user specified, but the one resulting from applying the default attribute paths and prefixes; for instance, \fChello\fR might resolve to \fCpackages.x86_64-linux.hello\fR and the empty string to \fCpackages.x86_64-linux.default\fR. .IP "\(bu" 2 \fCstorePath\fR: The paths in the Nix store containing the package. .IP "\(bu" 2 \fCactive\fR: Whether the profile contains symlinks to the files of this package. If set to false, the package is kept in the Nix store, but is not \[u201C]visible\[u201D] in the profile\[u2019]s symlink tree.