Jump to content

Nix vs. Linux Standard Base: Difference between revisions

Partial copy edit
(→‎Modifying a Package: Copy edit and shorten)
(Partial copy edit)
 
Line 1: Line 1:
This article is a comparison between the way [[Nix]] install packages to the filesystem hierarchy, and the [https://en.wikipedia.org/wiki/Linux_Standard_Base Linux Standard Base] (LSB) standard which most conventional Linux distributions, package managers and installers follow.
This article is a comparison between the [[Nix package manager]] and the [https://en.wikipedia.org/wiki/Linux_Standard_Base Linux Standard Base] (LSB) standard that the package managers of most conventional Linux distributions follow.


== Package Installation ==
== Package Installation ==


In most distributions, asking for a package to be installed, means having all its files available in the root filesystem (<code>/{,usr}/{bin,etc,lib,sbin,...}</code>).
In most distributions, files of an installed package are stored under <code>/{,usr}/{bin,etc,lib,...}</code>.


With Nix, the installed files of a package go into a ''profile'' (as if it was a rootfs), and you can have as many profiles as you want. There is the notion of each user having at least one profile, so `~/.nix-profile` points to the last version of the profile the user chose (last generation).
With Nix, the files of a package go into a ''profile'' (as if it was a rootfs), and users can have as many profiles as they want.


By default, the only part of the system made aware of the contents of the user profile is the PATH. The user PATH is set through bashrc to include `~/.nix-profile/bin`. So, by default, installing a Nix package means "having it in the PATH". A simple operation like <code>nix-env -i firefox</code> is meant to update the nix store, then generate a new profile in the store having all the programs ''installed'' plus the new one, and updating the symlink `~/.nix-profile`, so `~/.nix-profile/bin` will contain a symlink to the executable of firefox. Then a user can type <code>firefox</code> and have it running.
By default, the only part of the system made aware of the contents of the user profile is the PATH. The user PATH is set through bashrc to include `~/.nix-profile/bin`. So, by default, installing a Nix package means "having it in the PATH". A simple operation like <code>nix-env -i firefox</code> is meant to update the nix store, then generate a new profile in the store having all the programs ''installed'' plus the new one, and updating the symlink `~/.nix-profile`, so `~/.nix-profile/bin` will contain a symlink to the executable of firefox. Then a user can type <code>firefox</code> and have it running.
142

edits