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

liv.trivial.version: don't make it available as lib.version #64693

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FRidh
Copy link
Member

@FRidh FRidh commented Jul 13, 2019

because it's not uncommon that it gets accidentally used.

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@FRidh FRidh requested review from edolstra and nbp as code owners July 13, 2019 07:40
@FRidh
Copy link
Member Author

FRidh commented Jul 13, 2019

Example #64678

@FRidh
Copy link
Member Author

FRidh commented Jul 13, 2019

cc @timokau let's see if anything breaks

because it's not uncommon that it gets accidentally used.
@Ma27
Copy link
Member

Ma27 commented Jul 13, 2019

In that case you also want to drop the builtins.trace deprecation warning from lib.nixpkgsVersion.

So if I see this correctly, this is mostly a naming issue (a.k.a not everything from lib should be in the global "namespace"), not a direct problem with my change right? I have to admit that I don't remeber the exact reasons why I did the rename back then, but given the current issues, this seems fine to me 👍

@timokau
Copy link
Member

timokau commented Jul 13, 2019

Isn't lib.version somewhat of an antipattern itself? What are valid usecases? The only one I can find/ think of is doc generation.

@arcnmx
Copy link
Member

arcnmx commented Jul 19, 2019

Isn't lib.version somewhat of an antipattern itself? What are valid usecases?

maybe not valid but fwiw I use it in out-of-tree derivations and overlays as a way of determining which hash to use for things like buildRustPackage's cargoSha256 and buildGoModule's modSha256 because I don't want to be bothered with maintaining separate branches. I also use it as a way of marking packages as broken that don't have the meta.broken and platforms attributes set correctly in the stable channel but that's just laziness and maybe I should be submitting PRs to set it for the affected packages, or push for some changes to get backported...

In that case you also want to drop the builtins.trace deprecation warning from lib.nixpkgsVersion.

Worth noting that anything using the version to target multiple nixpkgs channels will want to use lib.trivial.version instead unless the warning is also removed from the stable channel, though I suppose (lib.version or lib.nixpkgsVersion) works too.

Side note: it's silly but one option that avoids the rename might be to simply include an assertion in mkDerivation or ofborg that version should never equate to the nixpkgs version so the mistake is caught at eval time, though I think nixpkgsVersion is more clear as a name anyway so...

@edolstra
Copy link
Member

Another argument for removing lib.version (and lib.nixpkgsVersion) is that eventually we may want to move the library into its own repository (i.e. as a separate flake) so it can be used outside of Nixpkgs/NixOS.

@drewrisinger
Copy link
Contributor

@FRidh should this be merged or closed? Feedback seems split.

@stale
Copy link

stale bot commented Jun 7, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 7, 2021
@wegank wegank marked this pull request as draft March 20, 2024 15:06
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 20, 2024
@wegank wegank added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants