postgrest icon indicating copy to clipboard operation
postgrest copied to clipboard

Move away from static-haskell-nix

Open robx opened this issue 3 years ago • 1 comments

We currently build a static PostgREST executable using https://github.com/nh2/static-haskell-nix. I think we should try moving away from that because

  • the project appears to be abandoned
  • the dependency makes it very difficult to upgrade nixpkgs

(This isn't really a new idea, I just wanted to file a central issue for tracking this.)

Some references:

  • https://github.com/PostgREST/postgrest/issues/2327
  • https://github.com/NixOS/nixpkgs/issues/43795
  • https://github.com/NixOS/nixpkgs/issues/61575
  • https://discourse.haskell.org/t/portable-haskell-executables-anyone-doing-that-possibly-using-nix/4816
  • https://github.com/PostgREST/postgrest/pull/2332

robx avatar Sep 19 '22 09:09 robx

I've done a bit of digging into pkgs.pkgsStatic today:

  • https://github.com/NixOS/nixpkgs/pull/191915
  • https://github.com/NixOS/nixpkgs/issues/191920

It looks like pkgsStatic goes quite a bit further than what we need to build a static PostgREST -- it builds a fully static package set, so it requires all PostgREST dependencies to build in a fully static environment, while all we need is the static build artifacts of all dependencies. E.g., this builds postgresql in an environment where only static libraries exist, which the build system seems not prepared for. We only need dontDisableStatic = true for our dependencies.

robx avatar Sep 19 '22 18:09 robx

The glcr.b-data.ch/ghc/ghc-musl images may be an alternative.
👉 https://github.com/benz0li/ghc-musl

benz0li avatar Aug 15 '23 04:08 benz0li

static-haskell-nix has recently seen some work again, with an update to nixos-23.05: https://github.com/nh2/static-haskell-nix/pull/116

robx avatar Sep 15 '23 16:09 robx