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

stdenv: make meta.position overridable #295973

Closed
wants to merge 2 commits into from

Conversation

lolbinarycat
Copy link
Contributor

this is done simply by changing the order in which attrsets are merged with //

fixes #295907

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added the 6.topic: stdenv Standard environment label Mar 14, 2024
this is done simply by changing the order in which attrsets are merged with //
@piegamesde
Copy link
Member

I can't judge for the validity of the motivation for this change, but at least there should be a comment about in the code, since this is a very subtle thing which may regress on the next refactoring. If there is the possibility of adding regression tests, that would be even better.

@lolbinarycat
Copy link
Contributor Author

i feel like if this needs a comment, then so would almost every use of //. i'll add a test.

@lolbinarycat
Copy link
Contributor Author

@piegamesde thanks for the review btw, is there any chance you could give #294347 a glance too?

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Mar 14, 2024
@piegamesde
Copy link
Member

Sorry my capacities are mostly bound elsewhere currently

@lolbinarycat
Copy link
Contributor Author

ok, thanks anyways

@ofborg ofborg bot added 10.rebuild-linux: 1-10 10.rebuild-linux: 1 and removed 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Mar 14, 2024
Copy link
Contributor

@philiptaron philiptaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, checks out.

@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Mar 19, 2024
Copy link
Contributor

@drupol drupol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diff LGTM

Copy link
Member

@Aleksanaa Aleksanaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this makes sense. But maybe it would be better to let someone who knows better judge it.

@Aleksanaa
Copy link
Member

To not let us in a dumb situation like last time (although seemingly not)

@Aleksanaa Aleksanaa removed the request for review from grahamc July 1, 2024 08:16
@eclairevoyant eclairevoyant added 12.approvals: 3+ This PR was reviewed and approved by three or more reputable people and removed 12.approvals: 1 This PR was reviewed and approved by one reputable person labels Jul 1, 2024
Copy link
Contributor

@philiptaron philiptaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's pretty self-explanatory; the only sticky situation would be if things further in the // block would prevent overrides... but they should prevent overrides actually.

This bit:

{
  # Expose the result of the checks for everyone to see.
  inherit (validity)
    unfree
    broken
    unsupported
    insecure
    ;

  available =
    validity.valid != "no"
    && (
      if config.checkMetaRecursively or false then all (d: d.meta.available or true) references else true
    );
}

@eclairevoyant
Copy link
Contributor

eclairevoyant commented Jul 1, 2024

What do you mean by "should prevent overrides" here? or rather why?

@philiptaron
Copy link
Contributor

What do you mean by "should prevent overrides" here? or rather why?

The five fields that are made consistent in this function are unfree, broken, unsupported, insecure, and available. Earlier in this file, the checkValidity function did work to turn the args.meta values into consistent fields. So if we were to place //args.meta after the block I cited, the meta values would be inconsistent.

Imagine a derivation with meta.insecure = "lol". We want the actual insecurity check that was performed above, not that value.

As I understand it, anyway.

@pbsds
Copy link
Member

pbsds commented Jul 25, 2024

my diff in the related effort #329900 (comment) might be of interest, it should apply here as well

@philiptaron
Copy link
Contributor

I'd like to merge this. Mind fixing the merge conflict?

@pbsds
Copy link
Member

pbsds commented Aug 13, 2024

from my related pr:

I can find both good and bad cases in the diff, i reckon most of the bad ones come from inherit (some-package) meta; which now becomes a major foot-gun

As such i'd like an entry into the release notes and some documentation covering this foot-gun

@philiptaron
Copy link
Contributor

@pbsds: in the diff you cited, are the following examples of "bad"?

-python311Packages.certbot-dns-ovh: ./pkgs/development/python-modules/certbot-dns-ovh/default.nix:37
-python311Packages.certbot-dns-rfc2136: ./pkgs/development/python-modules/certbot-dns-rfc2136/default.nix:35
-python311Packages.certbot-dns-route53: ./pkgs/development/python-modules/certbot-dns-route53/default.nix:35
+python311Packages.certbot-dns-ovh: ./pkgs/development/python-modules/certbot/default.nix:90
+python311Packages.certbot-dns-rfc2136: ./pkgs/development/python-modules/certbot/default.nix:90
+python311Packages.certbot-dns-route53: ./pkgs/development/python-modules/certbot/default.nix:90
-ocamlPackages.json-data-encoding-bson: ./pkgs/development/ocaml-modules/json-data-encoding/bson.nix:19
+ocamlPackages.json-data-encoding-bson: ./pkgs/development/ocaml-modules/json-data-encoding/default.nix:21
-steam-run: ./pkgs/games/steam/fhsenv.nix:344
-steam-run-native: ./pkgs/games/steam/fhsenv.nix:344
-steam-small: ./pkgs/games/steam/fhsenv.nix:313
+steam-run: ./pkgs/games/steam/steam.nix:43
+steam-run-native: ./pkgs/games/steam/steam.nix:43
+steam-small: ./pkgs/games/steam/steam.nix:43

And the following examples of "good"?

-vimPlugins.nvim-treesitter-parsers.yaml: ./pkgs/applications/editors/vim/plugins/vim-utils.nix:418
-vimPlugins.nvim-treesitter-parsers.yang: ./pkgs/applications/editors/vim/plugins/vim-utils.nix:418
-vimPlugins.nvim-treesitter-parsers.yuck: ./pkgs/applications/editors/vim/plugins/vim-utils.nix:418
-vimPlugins.nvim-treesitter-parsers.zathurarc: ./pkgs/applications/editors/vim/plugins/vim-utils.nix:418
-vimPlugins.nvim-treesitter-parsers.zig: ./pkgs/applications/editors/vim/plugins/vim-utils.nix:418
+vimPlugins.nvim-treesitter-parsers.yaml: ./pkgs/applications/editors/vim/plugins/nvim-treesitter/generated.nix:3139
+vimPlugins.nvim-treesitter-parsers.yang: ./pkgs/applications/editors/vim/plugins/nvim-treesitter/generated.nix:3150
+vimPlugins.nvim-treesitter-parsers.yuck: ./pkgs/applications/editors/vim/plugins/nvim-treesitter/generated.nix:3161
+vimPlugins.nvim-treesitter-parsers.zathurarc: ./pkgs/applications/editors/vim/plugins/nvim-treesitter/generated.nix:3172
+vimPlugins.nvim-treesitter-parsers.zig: ./pkgs/applications/editors/vim/plugins/nvim-treesitter/generated.nix:3183

And the following an example of "meh"?

-xaos: ./pkgs/applications/graphics/xaos/default.nix:44
+xaos: ./pkgs/applications/graphics/xaos/default.nix:12

@pbsds
Copy link
Member

pbsds commented Aug 13, 2024

correct

@lolbinarycat
Copy link
Contributor Author

I'd like to merge this. Mind fixing the merge conflict?

I no longer work on nixpkgs, I deleted my local clone, and my internet connection is prohibitively slow.

Sorry, but I'm gonna have to pass this along to someone else.

@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Sep 10, 2024
@Aleksanaa Aleksanaa requested review from Aleksanaa and drupol and removed request for drupol November 13, 2024 16:06
@wolfgangwalther
Copy link
Contributor

Superseded by #359191

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch 6.topic: stdenv Standard environment 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 10.rebuild-linux: 1 12.approvals: 3+ This PR was reviewed and approved by three or more reputable people
Projects
None yet
Development

Successfully merging this pull request may close these issues.

meta.position specification is not overridable via <pkg>.overrideAttrs overriding
9 participants