-
-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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: allow static compilation #70024
Conversation
5734be3
to
03809ba
Compare
@@ -17,8 +17,8 @@ common = | |||
, stateDir | |||
, confDir | |||
, withLibseccomp ? lib.any (lib.meta.platformMatch stdenv.hostPlatform) libseccomp.meta.platforms, libseccomp | |||
, withAWS ? stdenv.isLinux || stdenv.isDarwin, aws-sdk-cpp | |||
|
|||
, withAWS ? !enableStatic && (stdenv.isLinux || stdenv.isDarwin), aws-sdk-cpp |
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.
Probably best to keep these options separate. There’s no reason for aws to not work statically, but it is broken currently.
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.
Since it can't compile it seems better to do it in the package rather than at call time.
Unfortunately, without NixOS/nix#2698, you can’t use https-based stores. |
Just a comment: static nix by @matthewbauer has been very helpful. Having this built by nixpkgs would be great. |
Patch size has shrunk a bit. This builds and was useful to me, doing evaluation-only on terraform cloud (no root, no namespaces). https://github.com/NixOS/nixpkgs/compare/master...roberth:static-nix-2020-03-04?expand=1 |
That said, this should be supported through in the Nix release itself and not tacked on later. A patch like this helps: NixOS/nix#2698. |
NIX_LDFLAGS shouldn't be necessary with NixOS/nix#3194. I'm a bit behind on updating this PR. Feel free to open one with yours. We may just have to check in that .patch. |
IIRC Nix master also now compiles rust, which doesn't compile statically. Maybe that was fixed since I looked. |
It certainly possible to compile static rust binaries, not sure if we can make ours do so. |
I think probably the first step would be to add static compilation to github actions on nix repo. |
Are there actions for this? Current nixUnstable does not even build with pkgsMusl, let alone pkgsStatic |
The upstream flake defines a |
I guess I'm blind! Thanks Rob. |
It's not obvious at all. It just so happened that I've seen it there and I was subscribed to this thread. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/where-can-i-get-a-statically-built-nix/34253/1 |
Continuation of #56281
Nix compiles statically, but not everything is included: