nix-pills
nix-pills copied to clipboard
What's in a name?
I found this line confusing in pill 6:
name: the name of the derivation. In the nix store the format is hash-name, that's the name.
It's a little hard to scan. Also I think there's a distinction between a human readable name ("coreutils") and the name of a derivation (with a hash). So how about something like:
name: a human-readable name e.g. "coreutils". This forms part of the name in the nix store to make the paths more readable.
Does this help? https://stackoverflow.com/questions/56198420/what-is-the-syntax-of-a-valid-identifier-in-the-nix-language
That's the syntax of a valid identifier. My point was that the comment in the nix pill doesn't make clear (I think) the purpose of the 'name' attribute in a derivation, which is a slightly different thing I belive.
I find it slightly confusing with the , that's the name at the end. So is it hash-name, or is hash-name the name?
the name of a derivation is usually: {pname}-{version}, however a store path is usually the {hash}-{pname}-{version}.
maybe this will help:
[09:24:15] jon@jon-desktop /home/jon/projects/nixpkgs (master)
$ nix eval nixpkgs.python3.outPath
"/nix/store/gpnm7i19lpj8p43mjrdw03d0hjalmskl-python3-3.7.5"
[09:24:26] jon@jon-desktop /home/jon/projects/nixpkgs (master)
$ nix eval nixpkgs.python3.name
"python3-3.7.5"
[09:24:34] jon@jon-desktop /home/jon/projects/nixpkgs (master)
$ nix eval nixpkgs.python3.pname
"python3"
[09:24:39] jon@jon-desktop /home/jon/projects/nixpkgs (master)
$ nix eval nixpkgs.python3.version
"3.7.5"
for most packages, the name of a package gets determined here: https://github.com/NixOS/nixpkgs/blob/6b2504f9f20e79711e835ef412173ee2be542dc2/pkgs/stdenv/generic/make-derivation.nix#L191 and the store-path (hash + name) isn't determined until it needs to generate a .drv or dervation file (as it will need to evaluate all of the dependencies before this is deterimined)
Thanks - but my point is not that I don't understand it (I think I do) but that the pill could be reworded slightly to make it easier to grok :)
problem is that name can be used to describe a store-path-name, a derivation-name, and a package-name ;(