User Environment: Difference between revisions
imported>Nix m fix link |
mNo edit summary |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
'''''User Environments''''' are Nix’s mechanism for implementing the ability to allow different users to have different configurations, and to do atomic upgrades and rollbacks. Different users can have their own separate environments, and individual users can create multiple environments they can switch between. | |||
In Nix and NixOS, a user environment is a core concept in understanding how the system operates. This page serves as a quick reference. More documentation is present in parts of the {{Nix Manual}} and in the {{Nixpkgs Manual|name=Nixpkgs Manual: Chapter - Python Install Guide|anchor=#python}}, interspersed with [[Python]] install instructions. | |||
== Nix manual references == | == Nix manual references == | ||
Line 14: | Line 14: | ||
This would look like: | This would look like: | ||
❯ ls -l ~/.nix-profile | ❯ ls -l ~/.nix-profile | ||
lrwxrwxrwx | lrwxrwxrwx ... /home/username/.nix-profile -> /nix/var/nix/profiles/per-user/username/profile | ||
=== Package management section === | === Package management section === | ||
Line 25: | Line 25: | ||
==== Profiles ==== | ==== Profiles ==== | ||
In the opening of the {{Nix Manual|name=Nix Manual - | In the opening of the {{Nix Manual|name=Nix Manual - Profiles chapter|anchor=#sec-profiles}}: | ||
<blockquote>Profiles and '''''user environments''''' are Nix’s mechanism for implementing the ability to allow different users to have different configurations, and to do atomic upgrades and rollbacks. To understand how they work, it’s useful to know a bit about how Nix works. In Nix, packages are stored in unique locations in the Nix store (typically, ''/nix/store''). For instance, a particular version of the Subversion package might be stored in a directory ''/nix/store/dpmvp969yhdqs7lm2r1a3gng7pyq6vy4-subversion-1.1.3/'', while another version might be stored in ''/nix/store/5mq2jcn36ldlmh93yj1n8s9c95pj7c5s-subversion-1.1.2''. The long strings prefixed to the directory names are cryptographic hashes[1] of all inputs involved in building the package — sources, dependencies, compiler flags, and so on. So if two packages differ in any way, they end up in different locations in the file system, so they don’t interfere with each other. Figure 10.1, “''User environments''” shows a part of a typical Nix store. | <blockquote>Profiles and '''''user environments''''' are Nix’s mechanism for implementing the ability to allow different users to have different configurations, and to do atomic upgrades and rollbacks. To understand how they work, it’s useful to know a bit about how Nix works. In Nix, packages are stored in unique locations in the Nix store (typically, ''/nix/store''). For instance, a particular version of the Subversion package might be stored in a directory ''/nix/store/dpmvp969yhdqs7lm2r1a3gng7pyq6vy4-subversion-1.1.3/'', while another version might be stored in ''/nix/store/5mq2jcn36ldlmh93yj1n8s9c95pj7c5s-subversion-1.1.2''. The long strings prefixed to the directory names are cryptographic hashes[1] of all inputs involved in building the package — sources, dependencies, compiler flags, and so on. So if two packages differ in any way, they end up in different locations in the file system, so they don’t interfere with each other. Figure 10.1, “''User environments''” shows a part of a typical Nix store. | ||