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

In pure mode, set builtins.nixVersion to a constant #5971

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

Conversation

edolstra
Copy link
Member

@edolstra edolstra commented Jan 24, 2022

This prevents issues like
NixOS/nixpkgs#156527. Eventually we should do
this in impure mode as well.

Issue #5970.

Depends on #8330

This prevents issues like
NixOS/nixpkgs#156527. Eventually we should do
this in impure mode as well. Issue NixOS#5970.
@thufschmitt
Copy link
Member

I’m not sure it’s a good idea. Granted it’s a source of impurity, but so is builtins ? whatever. And it can be useful in some cases (nix-community/poetry2nix@5c06704 which is linked from the related issue is indeed a good example)

@edolstra
Copy link
Member Author

Yes, but expressions like builtins ? whatever are unlikely to end up embedded in strings like in NixOS/nixpkgs#156527.

@edolstra edolstra added this to the nix-2.7 milestone Jan 25, 2022
@roberth
Copy link
Member

roberth commented Jan 25, 2022

Adding a nixVersionAtLeast function seems like a good compromise. It produces a boolean, so it's unlikely to end up in a build like that.

@thufschmitt
Copy link
Member

Adding a nixVersionAtLeast function seems like a good compromise. It produces a boolean, so it's unlikely to end up in a build like that.

Yes, that sounds like a fairly good one

(and maybe just deprecating builtins.nixVersion for the time being to avoid breaking stuff too badly)

@edolstra edolstra modified the milestones: nix-2.7, nix-2.8 Mar 3, 2022
@edolstra edolstra modified the milestones: nix-2.8, nix-2.9 Apr 14, 2022
@edolstra edolstra modified the milestones: nix-2.9, nix-2.10 May 30, 2022
@edolstra edolstra modified the milestones: nix-2.10, nix-2.11 Jul 11, 2022
@edolstra edolstra modified the milestones: nix-2.11, nix-2.12 Aug 25, 2022
@edolstra edolstra modified the milestones: nix-2.12, nix-2.13 Dec 6, 2022
@edolstra edolstra modified the milestones: nix-2.13, nix-2.14 Jan 17, 2023
@edolstra edolstra modified the milestones: nix-2.14, nix-2.15 Feb 28, 2023
@fricklerhandwerk fricklerhandwerk added the language The Nix expression language; parser, interpreter, primops, evaluation, etc label Mar 3, 2023
@roberth
Copy link
Member

roberth commented May 23, 2023

Let's not forget about builtins.langVersion.

@roberth
Copy link
Member

roberth commented May 23, 2023

Adding a nixVersionAtLeast function seems like a good compromise.

This does make error messages less informative. Another solution is to poison the string context, similar to what we could do for secret strings, but slightly different allowed usages. String context poisoning has its own issue now:

@edolstra edolstra modified the milestones: nix-2.15, nix-2.16, nix-2.17 May 26, 2023
@fricklerhandwerk
Copy link
Contributor

Discussed in the Nix team meeting 2023-06-05:

  • @roberth proposes to add a comparison function instead and encourage its use, so version strings won't end up in builds
    • should deprecate nixVersion eventually of course
    • could be impureNixVersionAtLeast to signal
  • @edolstra: could ask what's the use case of knowing the version. usually to determine if a primop is available. but that's what ? is used
    • @roberth: in case we happen to release a buggy builtin, it my
  • @fricklerhandwerk: should the constant be something yelling "don't use"?
    • @edolstra: could stop incrementing it at 2.16
  • @Ericson2314: what speaks against removing it in pure eval?
  • conclusion: merge Automatically document builtin constants #8330 first so we can document nixVersion to be discouraged, pin output 2.16

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2023-06-05-nix-team-meeting-minutes-60/28933/1

@dpulls
Copy link

dpulls bot commented Jun 27, 2023

🎉 All dependencies have been resolved !

@edolstra edolstra modified the milestones: nix-2.17, nix-2.18 Jul 24, 2023
@edolstra edolstra modified the milestones: nix-2.18, nix-2.19 Sep 20, 2023
@edolstra edolstra modified the milestones: nix-2.19, nix-2.20 Nov 20, 2023
@edolstra edolstra modified the milestones: nix-2.20, nix-2.21 Mar 4, 2024
@edolstra edolstra modified the milestones: nix-2.21, nix-2.22 Mar 11, 2024
@edolstra edolstra modified the milestones: nix-2.22, nix-2.23 Apr 23, 2024
@edolstra edolstra removed this from the nix-2.23 milestone Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language The Nix expression language; parser, interpreter, primops, evaluation, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants