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

llvmPackages_{13,14,15,16,17,18,git}: commonify the default.nix #325175

Merged
merged 2 commits into from
Jul 9, 2024

Conversation

RossComputerGuy
Copy link
Member

@RossComputerGuy RossComputerGuy commented Jul 7, 2024

Description of changes

Drop all default.nix files for LLVM versions and simply the entrypoint to a common place. This will greatly reduce the amount of work to maintain LLVM and simply updating. Not bothering with LLVM 12 as it is a legacy version and it sits with the pre-monorepo setup which would increase complexity for this PR.

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.11 Release Notes (or backporting 23.11 and 24.05 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: llvm/clang Issues related to llvmPackages, clangStdenv and related label Jul 7, 2024
@RossComputerGuy RossComputerGuy force-pushed the feat/llvm-version-commonify branch 7 times, most recently from 5e89fd3 to 24bad6a Compare July 7, 2024 05:48
sha256 = "sha256-Tlk+caav7e7H6bha8YQyOl+x2iNk9iH7xKpHQkWQyJ4=";
};
}
];
Copy link
Contributor

Choose a reason for hiding this comment

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

There are a couple of ways to implement this and I'm not deadset on anything specific, just adding suggestions.

Suggestion, untested! - feel free to ignore: condensed but possibly a bit opaque:

versions = {
  "13.0.1".officialRelease.sha256 = "06dv6h5dmvzdxbif2s8njki6h32796v368dyb5945x8gjj72xh7k";
  "14.0.6".officialRelease.sha256 = "sha256-vffu4HilvYwtzwgq+NlS26m65DGbp6OSSne2aje1yJE=";
  "15.0.7".officialRelease.sha256 = "sha256-wjuZQyXQ/jsmvy6y1aksCcEDXGBjuhpgngF3XQJ/T4s=";
  "16.0.6".officialRelease.sha256 = "sha256-fspqSReX+VD+Nl/Cfq+tDcdPtnQPV1IRopNDfd5VtUs=";
  "17.0.6".officialRelease.sha256 = "sha256-8MEDLLhocshmxoEBRSKlJ/GzJ8nfuzQ8qn0X/vLA+ag=";
  "18.1.8".officialRelease.sha256 = "sha256-iiZKMRo/WxJaBXct9GdAcAT3cz9d9pnAcO1mmR6oPNE=";
  "19.0.0-git".gitRelease = {
    rev = "9b9405621bcc55b74d2177c960c21f62cc95e6fd";
    rev-version = "19.0.0-unstable-2024-06-30";
    sha256 = "sha256-Tlk+caav7e7H6bha8YQyOl+x2iNk9iH7xKpHQkWQyJ4=";
  };
}

# ...

llvmPackages = lib.mapAttrs' (version: args: mkPackage (args // { inherit version; })) versions

Another thought is to have a mechanism for overriding/extending it: take llvmVersions as a parameter defaulting to empty set. Then do versions // llvmVersions -- this would potentially allow users to override LLVM versions by putting llvmVersions = { ... } in their overlay. The issue I see with this is of keying the llvmPackage_{version} on the major version but having the attribute be a full version.

Copy link
Member Author

Choose a reason for hiding this comment

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

How would making the version list an attr set work with the officialRelease or gitRelease stuff?

Copy link
Contributor

Choose a reason for hiding this comment

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

That is already accounted for in my suggested code block, "13.0.1".officialRelease.sha256 expands to "13.0.1" = { officialRelease = { sha256 = ... }; } such that the only missing attribute is the version, which we reinject via mapAttrs' in mkPackage (args // { inherit version; } so that it reads officialRelease = { version = ..., sha256 = ...}. Then the last one is .gitRelease.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, I made it work with an attr set.

@RossComputerGuy RossComputerGuy force-pushed the feat/llvm-version-commonify branch 2 times, most recently from 245c8f9 to bcc1b79 Compare July 7, 2024 14:10
@RossComputerGuy RossComputerGuy marked this pull request as ready for review July 7, 2024 14:32
@RossComputerGuy
Copy link
Member Author

If someone nixpkgs-review's this and there's a rebuild count of 0 before Ofborg gets to this, I'll merge this.

@RossComputerGuy
Copy link
Member Author

error: attribute 'hostPlatform' missing

       at /ofborg/checkout/1/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/ofborg-evaluator-2/pkgs/stdenv/darwin/override-sdk.nix:412:29:

          411|       # deployment target does not require replacing the libc or SDK dependencies.
          412|       // lib.optionalAttrs (old.hostPlatform.darwinSdkVersion != darwinSdkVersion) {
             |                             ^
          413|         allowedRequisites = null;

Weird CI error.

@RossComputerGuy
Copy link
Member Author

Couldn't rebase on GitHub website since I can't access one of my systems right now. Will fix up the commits as soon as I can, maybe this will fix the CI fail.

@RossComputerGuy RossComputerGuy marked this pull request as ready for review July 7, 2024 18:45
@RossComputerGuy RossComputerGuy marked this pull request as draft July 7, 2024 18:46
Comment on lines -1526 to -1533
llvmPackages_git = recurseIntoAttrs (callPackage ../development/compilers/llvm/git {
inherit (stdenvAdapters) overrideCC;
buildLlvmTools = buildPackages.llvmPackages_git.tools;
targetLlvmLibraries = targetPackages.llvmPackages_git.libraries or llvmPackages_git.libraries;
targetLlvm = targetPackages.llvmPackages_git.llvm or llvmPackages_git.llvm;
});
Copy link
Contributor

Choose a reason for hiding this comment

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

This was added to aliases to prevent packages in nixpkgs from using it. Dropping it from aliases would change that. Is it intended that llvmPackages_git be usable in nixpkgs going forward?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't really care if LLVM git is or isn't in alias. I just moved it so all versions past 12 are using the commonified default.nix. Probably isn't a bad idea either way so Ofborg tests for the weekly git updates.

Copy link
Member

Choose a reason for hiding this comment

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

This was in aliases.nix on purpose — if packages in Nixpkgs start relying on it, it blocks us from keeping it up to date, and the point of llvmPackages_git is to always be up to date. Could you please move it back?

Copy link
Member

Choose a reason for hiding this comment

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

(For the same reason, e.g. linuxPackages_latest is in aliases.nix on purpose, because when it wasn't it created tension between keeping it up to date and keeping dependent packages working.)

Copy link
Member Author

Choose a reason for hiding this comment

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

linuxPackages_latest is in aliases.nix on purpose

Where is linuxPackages_latest in aliases.nix? I don't see it in there.

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved back into aliases.nix in #331880

Copy link
Member

Choose a reason for hiding this comment

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

Where is linuxPackages_latest in aliases.nix? I don't see it in there.

Sorry, I was mistaken about that. It's not in aliases.nix — it's been prevented from being used in Nixpkgs entirely through consistent review, and providing an alternative linuxHeaders package that doesn't promise to be "latest", even though in practice we update it as soon as we can.

@RossComputerGuy RossComputerGuy force-pushed the feat/llvm-version-commonify branch from e024141 to b2df0f7 Compare July 8, 2024 01:14
@github-actions github-actions bot added the 6.topic: stdenv Standard environment label Jul 8, 2024
@RossComputerGuy RossComputerGuy force-pushed the feat/llvm-version-commonify branch from b2df0f7 to 8bb4205 Compare July 8, 2024 01:30
@RossComputerGuy
Copy link
Member Author

@ofborg eval

@RossComputerGuy RossComputerGuy force-pushed the feat/llvm-version-commonify branch 2 times, most recently from 840aab0 to 45379cb Compare July 8, 2024 02:32
@RossComputerGuy
Copy link
Member Author

Huh, firefox.stdenv.cc.bintools is resulting in a different value that is causing a rebuild.

@RossComputerGuy RossComputerGuy force-pushed the feat/llvm-version-commonify branch from 45379cb to 71cf049 Compare July 8, 2024 03:30
@RossComputerGuy
Copy link
Member Author

It seems the recurse into attrs + call packages of the default.nix in mkPackage was causing issues.

@RossComputerGuy RossComputerGuy force-pushed the feat/llvm-version-commonify branch from 71cf049 to 297d1b1 Compare July 8, 2024 05:26
@ofborg ofborg bot added 8.has: clean-up 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 Jul 8, 2024
@RossComputerGuy RossComputerGuy marked this pull request as ready for review July 8, 2024 05:57
Comment on lines 365 to 366
&& !stdenv.targetPlatform.isAarch64
&& (lib.versionOlder darwin.apple_sdk.sdk.version "11.0")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
&& !stdenv.targetPlatform.isAarch64
&& (lib.versionOlder darwin.apple_sdk.sdk.version "11.0")
&& lib.versionOlder stdenv.targetPlatform.darwinSdkVersion "11.0"

will align this with the changes in https://github.com/NixOS/nixpkgs/pull/324155/files

then, which ever change has to deal with the merge conflicts with the deleted files can just re-delete the files and everything should just work.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sweet, I've made the change. Not gonna push until #324155 is merged.

@RossComputerGuy RossComputerGuy force-pushed the feat/llvm-version-commonify branch from 297d1b1 to cfe063d Compare July 9, 2024 00:22
@RossComputerGuy RossComputerGuy merged commit cc29ddc into NixOS:master Jul 9, 2024
21 checks passed
@RossComputerGuy RossComputerGuy deleted the feat/llvm-version-commonify branch July 9, 2024 03:38
Copy link
Contributor

Backport failed for release-24.05, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin release-24.05
git worktree add -d .worktree/backport-325175-to-release-24.05 origin/release-24.05
cd .worktree/backport-325175-to-release-24.05
git switch --create backport-325175-to-release-24.05
git cherry-pick -x 80e3c2c5d0d2138fad54896a19dc64260a066304 cfe063d174d955f88ce73e39a6de2bced18de065

@alyssais alyssais mentioned this pull request Aug 2, 2024
13 tasks
@RossComputerGuy RossComputerGuy mentioned this pull request Aug 8, 2024
13 tasks
pwaller added a commit to pwaller/nixpkgs that referenced this pull request Sep 15, 2024
Pull NixOS#320261 introduced the possibility to consistently override
dependencies within an llvm package set. I think NixOS#325175 accidentally
dropped this, so reinstate it.

Signed-off-by: Peter Waller <p@pwaller.net>
pwaller added a commit to pwaller/nixpkgs that referenced this pull request Sep 15, 2024
Pull NixOS#320261 introduced the possibility to consistently override
dependencies within an llvm package set. I think NixOS#325175 accidentally
dropped this, so reinstate it.

Signed-off-by: Peter Waller <p@pwaller.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related 6.topic: stdenv Standard environment 8.has: clean-up 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
None yet
Development

Successfully merging this pull request may close these issues.

6 participants