-
-
Notifications
You must be signed in to change notification settings - Fork 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
Use pkgsStatic instead of static-haskell-nix, bump to libpq 16 and support GSSAPI #3169
Conversation
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 like it's all working fine! 🚀
Yes... took me good while to make it that way :D Will do some more refactoring before I merge, though. |
This replaces the build via static-haskell-nix and will hopefully make it possible to cross compile in the future.
f91fc73
to
f9d96f6
Compare
Refactor done, this is in great shape now. Will merge if all pipelines pass. |
@develop7 please have a look at the pipelines in this PR. All the "Text .. (Nix)" pipelines, which should benefit from the prepopulate job, are building the same dependencies again, that the prepopulate job had to build. I think we are missing Edit: At the same time, I think the "CI / Build Linux static (Nix)" job does not need to wait on the prepopulate job. It doesn't benefit from it at all, because it only builds the static parts, which are not cached there anyway. |
@wolfgangwalther thanks for both the heads-up and the suggestion as well! I've noticed the unnecessary rebuilds yesterday and were a wee bit stuck fixing them. Trying it now. |
@wolfgangwalther didn't help. I've filed nix-community/cache-nix-action#27 and about to revert |
After merging, the Cachix / Seed Linux job failed. I didn't know it existed and it only runs on main. Should be fixed in 071a3d4. |
This MR broke the docker image. The artifact |
Before this change, the static executable was ~5 MB. Now it's ~12 MB - very similar to all the other dynamic builds. The docker image containers 370 MB of dependencies. This all looks like the build is actually dynamically linked. Yet:
|
The file size could be related to this:
The big number of dependencies seem to be added, because all the haskell dependencies are now listed in |
Perhaps https://github.com/nlewo/nix2container could help? I've heard it's lighter on the nix store. References: |
I think that would only change the way the docker image is created - but the problem is the input we are giving to this tool. The input has changed, and this is a problem. The main difference, from what I can tell, is:
This both works fine for actually building the static executable - but when using this derivation somewhere else (docker, here) then all the propagated build inputs are carried with it, and that's what lands in the image. |
I'm pretty sure that both findings (executable is bigger and closure for docker image is bigger) are directly related:
Those hardcoded paths are detected as dependencies by nix, and thus copied into the docker image - including many transitive dependencies, which blows up the image size. Not sure why those new builds are bigger now and contain so much more stuff. But if we fix that, the docker image will immediately become smaller again, too.
This had nothing to do with it. |
I found the additional store paths in the static libraries as well. The old |
The first commit replaces static-haskell-nix with a build of the static executable via the
pkgsStatic
overlay of nixpkgs. This supersedes #2332 to resolve #2478.Based on this, I also tried to cross-compile the static executable to aarch64, but this quickly fails because of NixOS/nixpkgs#36200. Cross-compiling Template Haskell is not easy. Will investigate further.
In the meantime, I also did the following:
There is room for improvement with the libpq package, which is basically just a stripped down postgresql package right now. It still builds the server, but without systemd, which makes it pull in a lot fewer dependencies - and makes it succeed on cross-platform builds, too. We could still do more here to really only build libpq and nothing else - which would surely be much quicker. Also we currently build it twice (once for the dynamic overlay and once for the static overlay), which can possibly be reduced to one. Furthermore, I suspect that the current way of overriding the "default postgresql version" package, effectively leads to having to rebuild some other dependencies that we use for our devtools, because they depend on that postgresql package for their version of libpq. TLDR: If we create a separate, small derivation just for libpq and pass that only to postgresql-lib (both for dynamic and static), that should be much more efficient.