-
-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
nixStatic: Fix darwin. #235990
nixStatic: Fix darwin. #235990
Conversation
This triggers a lot of new derivations, but it shouldn't affect anyone since they're new builds, not existing builds: |
Oh no wait, it also affects linux packages since I fixed the propagation of |
pkgs/top-level/stage.nix
Outdated
@@ -266,6 +266,11 @@ let | |||
} // lib.optionalAttrs (stdenv.hostPlatform.system == "powerpc64-linux") { | |||
gcc.abi = "elfv2"; | |||
}; | |||
} // lib.optionalAttrs stdenv.hostPlatform.isDarwin { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't make sense for isStatic
to be set on Linux and Darwin but not other operating systems.
} // lib.optionalAttrs stdenv.hostPlatform.isDarwin { | |
} // lib.optionalAttrs (!stdenv.hostPlatform.isDarwin) { |
]; | ||
}); | ||
nativeBuildInputs = (finalAttrs.nativeBuildInputs or []) | ||
++ lib.optional stdenv.hasCC [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change needs to be explained in the commit message.
Reverted the incorrect exec format rename, split all the changes in self contained commits with clear commit messages. |
8613374
to
90255f6
Compare
ping |
Bumping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me (except I think we can make one small readability improvement), but I'd really like to hear what @Ericson2314 thinks before it's merged.
pkgs/top-level/stage.nix
Outdated
crossSystem = { | ||
isStatic = true; | ||
parsed = stdenv.hostPlatform.parsed; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we combine this with the case for Linux below? It's a bit confusing to see the generic crossSystem defined, and then immediately be overridden on Linux.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, although now generic parsed
is defined, and then immediately overridden on Linux. Did you have something different in mind?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I meant more like this:
parsed = if stdenv.isLinux then makeMuslParsedPlatform stdenv.hostPlatform.parsed else stdenv.hostPlatform.parsed;
or
parsed = (if stdenv.isLinux then makeMuslParsedPlatform else lib.id) stdenv.hostPlatform.parsed;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, you're right much better now, thank you!
ping @Ericson2314 |
1 similar comment
ping @Ericson2314 |
Result of 6 packages built:
|
How do you use this? When I try this on macos
I get this error message
|
I'm not sure about how the flake output gets resolved, but if you use the non-flake command it's:
I'm on an |
That does indeed seem to be the issue!
works just fine, while
gives the error I wrote above. So for some reason it only works on arm macs and not on intel macs. |
|
Ah, I see! Btw, does |
@anka-213 Internally, on any system, Nixpkgs considers static builds to be cross-compiling, since it invokes static libraries. If it weren't "cross-compiled", Nix would have to build a static compiler and static host libraries for configure-time and build-time tools as well, wasting precious space and time. On Darwin specifically, there is no stable syscall interface, meaning |
Description of changes
Fix
nixStatic
on darwin. Some fixes in this PR are forpkgsStatic
in general but I have not tried any other derivation so they might not be enough.#214611 (comment)
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)