Skip to content
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

[RFC 0147] Redefine unstable version format and comparison #147

Closed
wants to merge 1 commit into from

Conversation

rhendric
Copy link
Member

#107, any% speedrun

Rendered

@AndersonTorres
Copy link
Member

Woohoo! Can I drop the older one? :3

@rhendric
Copy link
Member Author

Woohoo! Can I drop the older one? :3

I mean, if you're asking me, I'm a nobody and this is my first RFC; you're a committer and have worked on several. I defer entirely to your judgment. Maybe having two approaches in parallel makes it more likely that one will succeed, and 107 is farther along than this, obviously. But if you're sick of trying to keep 107 going, that would make sense to me also.

@kevincox
Copy link
Contributor

If you as the author think that this RFC is preferable feel free to close the old one. It can always be reopened to copied to a new RFC if interest in that approach reappears.

@Ericson2314
Copy link
Member

I rather we stop using parseDrvName, and have a "compare just versions" that no longer tries to ignore the name part.

Then we don't have to create any specifial cases for "unstable", right?

@rhendric
Copy link
Member Author

I rather we stop using parseDrvName, and have a "compare just versions" that no longer tries to ignore the name part.

Example? How would you compare "pkg-unstable-2023-05-27" to "pkg-1.2.0" (if the existing wording of the manual is followed) or "pkg-1.2-unstable-2023-05-27" to "pkg-1.2.1" (if NixOS/nixpkgs#234201 is adopted)?

@jtojnar
Copy link
Member

jtojnar commented May 28, 2023

Example? How would you compare "pkg-unstable-2023-05-27" to "pkg-1.2.0" (if the existing wording of the manual is followed) or "pkg-1.2-unstable-2023-05-27" to "pkg-1.2.1" (if NixOS/nixpkgs#234201 is adopted)?

  1. You would not compare name attributes, you would compare version attribute of the derivation, when present.
  2. nix-env --install without -A should be deprecated and -iA should gain the support for recording the attributes used to install.
  3. nix-env --upgrade should not really compare versions at all, --always should be always used. Because:
    • Nixpkgs can update security-critical dependencies without bumping the installed package version.
    • Or Nixpkgs can revert updates when they bring critical issues noticed after merging.
    • And Nixpkgs may switch from ancient stable versions of a project to recent git snapshots, and back when releases reappear. So unstable-2023-05-27 and 1.2.0 are really incomparable and we would want to always switch here anyway.

Alternately, we could deprecate nix-env completely in favour of flakes but I am not sure how far off that is. And it probably will not be removed for a while after anyway.

Either way, parseDrvName is an ugly hack and we should not add more project-wide infrastructure to improve nix-env. Just improve nix-env directly, it will make its eventual deprecation more clear-cut.

@rhendric
Copy link
Member Author

rhendric commented May 28, 2023

So much for nix-env. What should a Nixpkgs package do if it wants to compare the version of a dependency against a known version string, to permit/forbid the derivation or to enable/disable a feature or patch? If my package uses lib.versionAtLeast some-dep.version "1.2.1", and some-dep.version is either "unstable-2023-05-27" (status quo) or "1.2-unstable-2023-05-27" (NixOS/nixpkgs#234201), how do we get the result of the versionAtLeast call to be false?

Nixpkgs could have its own version comparison logic, deviating from builtins.compareVersions; would that be tolerated?

@alyssais
Copy link
Member

alyssais commented May 28, 2023 via email

@jtojnar
Copy link
Member

jtojnar commented May 28, 2023

If my package uses lib.versionAtLeast some-dep.version "1.2.1", and some-dep.version is either "unstable-2023-05-27" (status quo) or "1.2-unstable-2023-05-27" (NixOS/nixpkgs#234201), how do we get the result of the versionAtLeast call to be false?

builtins.compareVersions "1.2-unstable-2023-05-27" "1.2.1" already behaves as you would expect so no changes to compareVersions should be necessary.

And you do not even need parseDrvName as version is easily accessible during evaluation. Which is, as I understand it, what John is saying.

So the only part that is could be needed is prefixing the version string with the last stable version for unstable packages. Which is precisely the bikeshed-prone part #107 got stuck on.

@rhendric
Copy link
Member Author

builtins.compareVersions "1.2-unstable-2023-05-27" "1.2.1" already behaves as you would expect so no changes to compareVersions should be necessary.

That's true, and I had thought it wasn't. Mea culpa.

Yeah, great, if we can ignore nix-env and parseDrvName, then everything I care about is under ‘future work’ here or is captured in NixOS/nixpkgs#234201. Closing until and unless that PR runs into objections that would require a larger change to resolve.

@rhendric rhendric closed this May 30, 2023
@rhendric rhendric deleted the rhendric/rfc-0147 branch May 30, 2023 22:41
eclairevoyant added a commit to eclairevoyant/nixpkgs that referenced this pull request Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants