Skip to content

Build static executable for linux aarch64 (w/ TH) - #4193

Merged
wolfgangwalther merged 2 commits into
PostgREST:mainfrom
wolfgangwalther:ghc-9-6
Apr 19, 2026
Merged

Build static executable for linux aarch64 (w/ TH)#4193
wolfgangwalther merged 2 commits into
PostgREST:mainfrom
wolfgangwalther:ghc-9-6

Conversation

@wolfgangwalther

Copy link
Copy Markdown
Member

Compared to #3866, this also enables building the static executable for Linux aarch64, but keeping Template Haskell around. This is based on upstream work to make Template Haskell work with GHC 9.6+ in Nixpkgs. It's currently based off my personal branch, which is subject to change and disappear eventually. Thus, this is not ready to merge, yet. But it works.

Also, the release process around the docker image still needs to be tested.

Note: This does not mean we can suddenly start using Template Haskell everywhere again. The main problem of Template Haskell is still there: We can't cross-compile it. And we'll still want to cross-compile static executables to FreeBSD, eventually. And maybe even Windows. So the long-term goal should still be to get rid of Template Haskell.

Also, we can only do this update here, because we pin hsie to use GHC 9.4 in the second commit. We will fall over this eventually, when GHC 9.4 is not supported in Nixpkgs anymore - or when we start using syntax that is GHC 9.6+ only at some point. hsie is tightly coupled to internal GHC APIs to do its thing, so non-trivial to update. @taimoorzaeem maybe you can look into that? Since we can separate the pin for hsie easily, it might make sense - depending on the required changes - to just jump to e.g. GHC 9.12 immediately and don't even work with the intermediate versions. Or, if it's easier do it one version at a time - whatever works best, I guess.

@taimoorzaeem

Copy link
Copy Markdown
Member

[...] we start using syntax that is GHC 9.6+ only at some point. hsie is tightly coupled to internal GHC APIs to do its thing, so non-trivial to update. @taimoorzaeem maybe you can look into that?

Sure, I can look into that. I'll put this in my backlog. Is nixpkgs dropping support for GHC 9.4 anytime soon?

Comment thread src/PostgREST/AppState.hs Outdated
@wolfgangwalther

Copy link
Copy Markdown
Member Author

Sure, I can look into that. I'll put this in my backlog. Is nixpkgs dropping support for GHC 9.4 anytime soon?

I don't think so, no. Pretty sure that this will not happen before November this year, but maybe even not well into next year. So a lot of time there :)

Comment thread src/PostgREST/AppState.hs Outdated
@wolfgangwalther
wolfgangwalther force-pushed the ghc-9-6 branch 3 times, most recently from 2998546 to 612dfec Compare August 16, 2025 08:30
@wolfgangwalther wolfgangwalther mentioned this pull request Apr 17, 2026
3 tasks
@wolfgangwalther
wolfgangwalther force-pushed the ghc-9-6 branch 2 times, most recently from 0ddeff4 to b4e6060 Compare April 19, 2026 09:26
@wolfgangwalther

Copy link
Copy Markdown
Member Author

Moved the update to the latest nixpkgs-unstable version to #4826.

Also, we can only do this update here, because we pin hsie to use GHC 9.4 in the second commit. We will fall over this eventually, when GHC 9.4 is not supported in Nixpkgs anymore - or when we start using syntax that is GHC 9.6+ only at some point. hsie is tightly coupled to internal GHC APIs to do its thing, so non-trivial to update. @taimoorzaeem maybe you can look into that? Since we can separate the pin for hsie easily, it might make sense - depending on the required changes - to just jump to e.g. GHC 9.12 immediately and don't even work with the intermediate versions. Or, if it's easier do it one version at a time - whatever works best, I guess.

This will be taken care of in #4797, I think.

@wolfgangwalther

Copy link
Copy Markdown
Member Author

This will be taken care of in #4797, I think.

Nope, postgrest-lint fails locally for me, with this branch. Took @mkleczek's hsie changes from #4797 to fix it.

wolfgangwalther and others added 2 commits April 19, 2026 19:52
Jumping past GHC 9.6, 9.8 and 9.10 immediately, because these versions
do not successfully build the static binary with TemplateHaskell and
iserv-proxy, yet.

Michal wrote the changes to hsie.

Co-authored-by: Michal Kleczek <michal@kleczek.org>
Also makes the aarch64 variant of the docker image consist of a single
static executable, similar to the x86_64 variant.
@wolfgangwalther

Copy link
Copy Markdown
Member Author

All jobs passed on the last run, just rebased to resolve a trivial (comment-only) merge conflict. Will merge this now, but will only know whether the actual changes to the release job for the aarch64 artifact work, when the release job on the main branch has run through. Will iterate from there, if that's not the case.

@wolfgangwalther
wolfgangwalther merged commit fee820b into PostgREST:main Apr 19, 2026
34 of 36 checks passed
@wolfgangwalther
wolfgangwalther deleted the ghc-9-6 branch April 19, 2026 17:53
@wolfgangwalther

Copy link
Copy Markdown
Member Author

Had to fix something after merge, but the release has then worked fine. We now have a docker image with both tiny layers consisting of a single executable only. No big ubuntu image for arm anymore.

@steve-chavez

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants