supabase / postgres

Unmodified Postgres with some useful plugins

Home Page:https://supabase.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nix build working on aarch64-darwin

samrose opened this issue · comments

Chore

Currently the nix portion of this project will not build directly/natively on darwin (but will build if you configure a remote vm or physical machine builder).

It's not critical that the nix portion of this project build on aarch64-darwin today, as our targets are aarch64-linux and x86_64-linux however for people in the organization or open source users to work with the nix portions of this project, it could be optimal to be able to build it on aarch64-darwin

The current known limitations seem to be rooted in https://github.com/pgcentralfoundation/pgrx/blob/develop/flake.nix while it tries to support the system https://github.com/pgcentralfoundation/pgrx/blob/develop/flake.nix#L16

...it might lack the needed ld linking to xcode -sourced libs when building on aarch64-darwin https://github.com/pgcentralfoundation/pgrx/blob/develop/flake.nix#L98 which is usually something like

(if stdenv.cc.isClang && stdenv.isDarwin then [ NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}";] else []);

So, this task is to try and either upstream that solution, or override locally, and possibly tease out other issues beyond that, so that users can opt to build natively in aarch64-darwin

In order to maintain this, we would also need to set up a macos builder as well (which is another task)

The current known limitations seem to be rooted in https://github.com/pgcentralfoundation/pgrx/blob/develop/flake.nix while it tries to support the system https://github.com/pgcentralfoundation/pgrx/blob/develop/flake.nix#L16

@samrose The link appears to be broken due to Nix code being removed in pgcentralfoundation/pgrx#1682. The last valid reference to flake.nix on their develop branch is https://github.com/pgcentralfoundation/pgrx/blob/99dee7c4a27883e7a9880397e419a2e359ee2da7/flake.nix. Nix is, however, reintroduced in pgcentralfoundation/pgrx#1683, which might benefit from input.

@garrettmichaelgeorge thanks.

I actually think my theory above was wrong, and that the issue is simply referencing the correct sdk paths when isDarwin in a build, to get the all of the extensions etc to build natively that use pgrx

Probably I will be able to dig into this later next week

Nix is, however, reintroduced in pgcentralfoundation/pgrx#1683, which might benefit from input.

Yes, it would.

I can't merge a PR that's supposedly for the benefit of the Nix community if the Nix community has no feedback on it.

@workingjubilee I'll look over there as soon as I can

In recent efforts to push this forward I also found https://github.com/NixOS/nixpkgs/pull/294504/files which is a PR to nixpkgs that is related to a lot of the issues that I had in getting our supabase nix work to successfully build on aarch64-darwin .

Nice!

Yeah, a lot of nix-darwin is kinda... jank.