-
Notifications
You must be signed in to change notification settings - Fork 13.7k
nix: static build #5814
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
nix: static build #5814
Changes from 4 commits
b4ac6f0
51ec91b
498e998
bf11052
db22ce3
48830d7
3cfb0f0
d12f239
bc51e28
7a2ca8b
4aa00f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,6 @@ | ||||||||||
| { | ||||||||||
| lib, | ||||||||||
| glibc, | ||||||||||
| config, | ||||||||||
| stdenv, | ||||||||||
| mkShell, | ||||||||||
|
|
@@ -30,6 +31,7 @@ | |||||||||
| useRocm ? config.rocmSupport, | ||||||||||
| useVulkan ? false, | ||||||||||
| llamaVersion ? "0.0.0", # Arbitrary version, substituted by the flake | ||||||||||
| buildStatic ? false, | ||||||||||
|
||||||||||
| }@inputs: | ||||||||||
|
|
||||||||||
| let | ||||||||||
|
|
@@ -167,6 +169,9 @@ effectiveStdenv.mkDerivation ( | |||||||||
| # TODO: Replace with autoAddDriverRunpath | ||||||||||
| # once https://github.com/NixOS/nixpkgs/pull/275241 has been merged | ||||||||||
| cudaPackages.autoAddOpenGLRunpathHook | ||||||||||
| ] | ||||||||||
| ++ optionals buildStatic [ | ||||||||||
| glibc.static | ||||||||||
|
||||||||||
| ++ optionals buildStatic [ | |
| glibc.static | |
| ++ optionals (stdenv.hostPlatform.isGnu && stdenv.hostPlatform.isStatic) [ | |
| glibc.static |
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.
Shouldn't buildStatic (static if renamed) take precedence?
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.
I think @SomeoneSerge is correct - or more specifically enableStatic going with @philiptaron suggestion. I have no idea how to do this in this smart GitHub interface though.
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.
The thing is that there are other static builds using other libc implementations -- musl being a great example -- that don't require adding glibc static edition. I agree that the test should include enableStatic rather than my proposal of stdenv.hostPlatform.isStatic.
The other approach, since you're hosting the stdenv, is that you add in glib.static in your hosting flake. That would work too, I think, and likely be closer to "right all the time."
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.
I see what you mean. I agree that adding glib.static to the hosting flake would work but the problem I guess is then that anybody wanting a static build would have to know that they need to do so. It feels a bit more explicit to have it here too. I've implemented these changes in d12f239 and fixed some small issues so the branch now passes all tests on my end.
Uh oh!
There was an error while loading. Please reload this page.