3 ms·
Pinning in the Nix world means pinning an entire Nixpkgs. You pin a program and all its dependencies by pinning the whole root of the "ecosystem." If you want
by mbrock 8y ago
Pinning in the Nix world means pinning an entire Nixpkgs. You pin a program and all its dependencies by pinning the whole root of the "ecosystem."
If you want to deal with N separate programs that are each pinned independently, you will point to N different revisions of Nixpkgs.
One NixOS configuration file can point to several different specific revisions of Nixpkgs. This is done with a so called "import from derivation" in the Nix expression language.
You can look at this page (scroll to the bottom to skip backwards compatibility):
https://nixos.wiki/wiki/How_to_fetch_Nixpkgs_with_an_empty_NIX_PATH https://nixos.wiki/wiki/How_to_fetch_Nixpkgs_with_an_empty_N...
There "pkgs" becomes defined as a specific Nixpkgs revision regardless of which revision is used by "nixos-rebuild" for example.
This would all be clearer with a real example, sorry...
- geokon 8y agoI've got the same confusion as the parent poster, but going a bit further - so does each revision of Nixpkgs have just one version of say openssl? How about if 2 different programs are built around 2 different version of OpenSSL? How do they coexist in one revision of Nixpkgs? I actually don't really understand how this is handled in other package-managers as well. B/c in the case of libraries, having 2 versions floating around can lead to double linking and duplicate symbols and all sorts of subtle problems.
- mbrock 8y agoNixpkgs does carry more than one version of some packages, but only when the maintainers deem it necessary. These are treated as separate packages with different names. In the case of OpenSSL, Nixpkgs currently has two packages named openssl_1_0_2 and openssl_1_1, with openssl being an alias for latter. Different programs depending on different versions can be installed at the same time without conflict. Full paths to dynamic library files are used in binaries instead of relying on a global library path.