-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mkDerivation: Expose pname & version in meta #68620
base: master
Are you sure you want to change the base?
Conversation
Nix only knows of `name` attribute and considers `pname` what parseDrvName spits out. Unfortunately, that fails to account for many real-life packages that have variants or dashes followed by number in their name. Since many of packages in nixpkgs already have pname corresponding to project name, we will export it here. We will fallback to the parseDrvName algorithm when pname is not present. We handle the version similarly. This will be useful for Repology as well as any other scripted processing of Nixpkgs JSON dump. See: https://github.com/NixOS/nixos-homepage/issues/306
Well, we need to get the project name somehow, even when On the other hand, going your proposed route route would allow us to consider |
As fair as I know, we do not have formally defined semantics for
Those derivations would not be listed by |
It looks like And things like |
That's one of the reasons I really dislike this "unstable-" versions naming. It confuses things, and I can see almost no advantages of that scheme. For example, I use |
And things like `auto-patchelf-hook` are not filtered out. Weirdly, Repology [ignores it](https://repology.org/projects/?search=auto-patchelf-hook), even though I did not see any relevant ignore rule.
Given the attention to version availability, a completely unique name without version might be enough to ignore by default.
|
# algorithm when pname is not present. | ||
# We handle the version similarly. | ||
pname = attrs.pname or (builtins.parseDrvName attrs.name).name; | ||
version = attrs.version or ((x: if x != "" then x else null) (builtins.parseDrvName attrs.name).version); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @volth that we should not have these fallbacks to parseDrvName
because it is surprising to me that it would work like that. pname
typically goes into name
, so it is weird for name
to go into pname
in some cases.
Without these fallbacks the change seems quite uncontroversial. You are just saying make the attrs available in meta if they were passed in to mkDerivation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to make something like nameForRepology
in the website export code with this logic, we could do that.
I don't think this is a good idea because it creates the possibility of the attributes in the derivation being inconsistent with the ones in |
Yeah, this is definitely a concern but we do need some way to find the version. Since is not extractable from |
Can we add pname and version to |
related #75813 |
I think that, when |
The `pname` passed to `stdenv.mkDerivation` consists of the name prefix as well as the `pname` passed to `stdenv.mkDerivation`. This is needed in case we want to test for valid `pname` in `stdenv.mkDerivation`. NixOS#68620 (comment)
I marked this as stale due to inactivity. → More info |
What is the status? What need to happen that this can get merged? |
I marked this as stale due to inactivity. → More info |
What is the status? What need to happen that this can get merged? [2] |
Nix only knows of
name
attribute and considerspname
what parseDrvName spits out. Unfortunately, that fails to account for many real-life packages that have variants or dashes followed by number in their name. Since many of packages in nixpkgs already have pname corresponding to project name, we will export it here. We will fallback to the parseDrvName algorithm when pname is not present.We handle the version similarly.
This will be useful for Repology as well as any other scripted processing of Nixpkgs JSON dump.
See: https://github.com/NixOS/nixos-homepage/issues/306