nix-pills icon indicating copy to clipboard operation
nix-pills copied to clipboard

What's in a name?

Open cdyson37 opened this issue 6 years ago • 7 comments

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.

cdyson37 avatar Jul 02 '19 16:07 cdyson37

Does this help? https://stackoverflow.com/questions/56198420/what-is-the-syntax-of-a-valid-identifier-in-the-nix-language

toraritte avatar Jul 02 '19 17:07 toraritte

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.

cdyson37 avatar Jul 02 '19 18:07 cdyson37

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?

darthdeus avatar Nov 20 '19 17:11 darthdeus

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"

jonringer avatar Nov 20 '19 17:11 jonringer

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)

jonringer avatar Nov 20 '19 17:11 jonringer

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 :)

cdyson37 avatar Nov 22 '19 09:11 cdyson37

problem is that name can be used to describe a store-path-name, a derivation-name, and a package-name ;(

jonringer avatar Nov 22 '19 10:11 jonringer