Skip to content

Conversation

@RossComputerGuy
Copy link
Member

Things done

Fixes evaluation of:

(import nixpkgs {
  crossSystem = {
    system = "aarch64-linux";
    useLLVM = true;
  };
  localSystem = {
    system = "aarch64-linux";
    useLLVM = true;
  };
}).stdenv

This does not make it usable. Making it usable will be a follow up PR.

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/adding-usellvm-to-a-nixos-system-flake/66487/2

@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 1001-2500 This PR causes many rebuilds on Linux and should target the staging branches. 6.topic: stdenv Standard environment 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related labels Nov 20, 2025
@RossComputerGuy RossComputerGuy marked this pull request as draft November 20, 2025 03:47
@RossComputerGuy RossComputerGuy changed the base branch from master to staging November 20, 2025 03:48
@RossComputerGuy RossComputerGuy marked this pull request as ready for review November 20, 2025 03:48
@nixpkgs-ci nixpkgs-ci bot closed this Nov 20, 2025
@nixpkgs-ci nixpkgs-ci bot reopened this Nov 20, 2025
@github-project-automation github-project-automation bot moved this to Done in Stdenv Nov 20, 2025
@RossComputerGuy RossComputerGuy moved this from Done to Todo in Stdenv Nov 20, 2025
runCommand "llvm-binutils-${version}"
{
pname = "llvm-binutils";
inherit version;
Copy link
Member

Choose a reason for hiding this comment

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

What does this have to do with fixing eval?

Copy link
Member Author

Choose a reason for hiding this comment

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

It makes the expression I mentioned actually evaluate.

Copy link
Member

Choose a reason for hiding this comment

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

But why?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because the nixpkgs configuration fails here with missing attribute errors and it's needed for #463395

pname = prevStage.bintools.bintools.pname + "-patchelfed-ld";
inherit (prevStage.bintools.bintools) version;

Copy link
Member

Choose a reason for hiding this comment

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

Could the commit message please explain that stdenv needs those attributes? Apart from that LGTM.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@LordGrimmauld LordGrimmauld left a comment

Choose a reason for hiding this comment

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

I can confirm this does fix eval. I am building my toy VM against this just to see how far i get. I don't feel confident approving this, stdenv is a bit out of my expertise, but this does look useful

@LordGrimmauld
Copy link
Contributor

Interesting, while eval does succeed with this, pkgs.stdenv.cc still seems to be gcc.
image

So i guess "Making it usable will be a follow up PR." entails a bit more than just fixing eval.

@RossComputerGuy
Copy link
Member Author

Yes, #463395 actually makes it possible. This PR just makes eval not broken. My idea is to have the native LLVM not cause any side effects so the eval fix is in its own PR.

Adds the pname & version since `pkgs/stdenv/linux/default.nix`
inherits the version & appends a string to the name.
installPhase = ''
mkdir -p "$out"/bin
cp -a '${prevStage.bintools.bintools}'/bin/* "$out"/bin/
cp -a '${prevStage.binutils.bintools}'/bin/* "$out"/bin/
Copy link
Member

Choose a reason for hiding this comment

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

Won't this do the wrong thing when we're using LLVM bintools?

Copy link
Member Author

Choose a reason for hiding this comment

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

Isn't binutils an alias for whatever linker is configured via linker in {local,cross}System?

Copy link
Member

Choose a reason for hiding this comment

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

No, that's what bintools is. binutils is GNU binutils.

Copy link
Member Author

Choose a reason for hiding this comment

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

Huh, I'll have to take a look at what I did. It might've been an infinite recursion thing. I'm traveling right now so I won't be able to look at it for some time.

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 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 1001-2500 This PR causes many rebuilds on Linux and should target the staging branches.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

4 participants