nix-env: Use pname and version attrs in -q#4463
Conversation
|
Verified that this patch prints correct values in Unstable Nix: This patch: |
|
Wanted to mark this as closing https://github.com/NixOS/nixos-homepage/issues/306 but that issue disappeared (still accessible through API). |
|
I'm hesitant to modify the semantics of |
|
We still use |
|
I marked this as stale due to inactivity. → More info |
|
Still relevant |
|
In case this PR is not accepted (which seems so?), a replacement is needed here: How to use With What would be the equivalent using Maybe |
Previously[1], we started including `pname` and `version` keys in `nix-env -qa --json` output (and thus in packages.json). But those values were obtained using parseDrvName, which does not work in many cases, for example when a project does not follow Nix’s arbitrary requirement that version names have to start with a digit. The keys are also misleading as many modern Nixpkgs packages pass identically named attributes to mkDerivation but these keys do not use those values. Let’s fix this discrepancy by officially recognizing `pname` and `version` attributes as special and using them in the JSON output. This will be useful for Repology as well. [1]: NixOS@cd933b2
9b0232a to
60d6edf
Compare
|
It might be prudent to generate the repology info in a way that is agnostic to |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/nixpkgs-cli-working-group/30517/1 |

Previously1, we started including
pnameandversionkeys innix-env -qa --jsonoutput (and thus in packages.json).But those values were obtained using parseDrvName, which does not work in many cases, for example when a project does not follow Nix’s arbitrary requirement that version names have to start with a digit.
The keys are also misleading as many modern Nixpkgs packages pass identically named attributes to mkDerivation but these keys do not use those values.
Let’s fix this discrepancy by officially recognizing
pnameandversionattributes as special and using them in the JSON output.This will be useful for Repology as well.