this post was submitted on 29 Aug 2023
5 points (100.0% liked)
nixos
1262 readers
2 users here now
All about NixOS - https://nixos.org/
founded 4 years ago
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I can at least try to define the concepts I mentioned in my comment.
/nix/store/
. It has the format/nix/store/--
. Every installed package gets a store path. There is other stuff too - if you use flakes each flake and each flake input are copied to a store path before being evaluated. IIUC certain directories within each store path are treated specially. For example if a store path has abin/
directory, and that store path is included in your user "profile" of installed packages, then everything in thatbin/
directory is automatically symlinked to your profilebin/
directory, which is in your$PATH
. For example,nixpkgs.git
, the value you get is a derivation. But you can also make derivations yourself using functions likestdenv.mkDerivation
orwriteShellApplication
. I think you can even write an attribute set from scratch if you want to.To get from a Nix attribute set to a set of files there is a process called instantiation that is separate from evaluation of Nix expressions. (By "expressions" I mean Nix programs, anything in a
.nix
file.) Certain Nix programs will evaluate a Nix expression, read a derivation that the expression produces, and do the instantiation to actually create the files. As I mentioned the derivation includes all of the information necessary to do this. Part of this process actually serializes each derivation to a file in/nix/store/
- that's what the.drv
files in there are. Those are very-specialized scripts that produce store paths.