Skip to content

Minor check-meta.nix optimisations and cleanups#466947

Merged
adisbladis merged 6 commits into
NixOS:masterfrom
tweag:check-meta-cleanups
Dec 14, 2025
Merged

Minor check-meta.nix optimisations and cleanups#466947
adisbladis merged 6 commits into
NixOS:masterfrom
tweag:check-meta-cleanups

Conversation

@infinisil

@infinisil infinisil commented Dec 1, 2025

Copy link
Copy Markdown
Member

Various minor performance optimisations and some refactorings. Motivated as preparation for #338267

Things done


Add a 👍 reaction to pull requests you find important.

@infinisil infinisil force-pushed the check-meta-cleanups branch from 6cf94a3 to f3ff0bd Compare December 1, 2025 21:11
@nixpkgs-ci nixpkgs-ci 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. 6.topic: stdenv Standard environment labels Dec 1, 2025
@infinisil infinisil requested a review from adisbladis December 1, 2025 21:50
@infinisil

Copy link
Copy Markdown
Member Author

Performance stats are looking good, about a 1% improvement: https://github.com/NixOS/nixpkgs/actions/runs/19837639476?pr=466947#summary-56839009923

- Makes the code more clean and obvious
- Allows remediations to depend on values computed during the check
  (useful for NixOS#338267)
Probably that's a historical artifact
Remove some clearly-unnecessary ones and add some direly-needed ones
- Avoid some attribute set accesses
- Make a variable more local, avoiding a thunk
- Avoid always checking config.checkMeta for every attribute
- Boolean operator short-circuit optimisation
- Eta-reduction and make some allow/blocklist-dependend functions more cachable
- Inline functions that are only used once
- Make getEnv cached
- Remove the internal conditioning on the result of `valid`, we can know
  exactly when which value is produced
- Faster success path for checkMeta, also avoiding an environment
- Inline handlers
@infinisil infinisil force-pushed the check-meta-cleanups branch from f3ff0bd to 660cecd Compare December 2, 2025 13:51
@infinisil infinisil marked this pull request as ready for review December 2, 2025 13:52
@infinisil infinisil changed the title [WIP] Minor check-meta.nix optimisations and cleanups Minor check-meta.nix optimisations and cleanups Dec 2, 2025
@infinisil

Copy link
Copy Markdown
Member Author

I'll merge this soon myself unless I get a review. I don't think there's a reason not to have this :)

@adisbladis adisbladis added this pull request to the merge queue Dec 14, 2025
@adisbladis

Copy link
Copy Markdown
Member

Looks great!

Merged via the queue into NixOS:master with commit 56fc8b9 Dec 14, 2025
30 of 31 checks passed
@github-project-automation github-project-automation Bot moved this to Done in Stdenv Dec 14, 2025
@K900

K900 commented Dec 14, 2025

Copy link
Copy Markdown
Contributor

This broke release-checks.

@K900

K900 commented Dec 14, 2025

Copy link
Copy Markdown
Contributor

@vcunat

vcunat commented Dec 14, 2025

Copy link
Copy Markdown
Member

Thanks. I was just bisecting what broke it.

@infinisil

Copy link
Copy Markdown
Member Author

Aw damn :/

@infinisil infinisil deleted the check-meta-cleanups branch December 15, 2025 13:36
@infinisil

Copy link
Copy Markdown
Member Author

Reapply with fix in #471029

reason = "broken";
errormsg = "is marked as broken";
remediation = remediate_allowlist "Broken" (x: "");

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Suggested change
remediation = remediate_allowlist "Broken" (x: "");
remediation = remediate_allowlist "Broken" (x: "") attrs;

This was the problem/fix for reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: stdenv Standard environment 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.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants