Skip to content
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 build working on aarch64-darwin #936

Closed
samrose opened this issue Apr 5, 2024 · 6 comments
Closed

nix build working on aarch64-darwin #936

samrose opened this issue Apr 5, 2024 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@samrose
Copy link
Contributor

samrose commented Apr 5, 2024

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)

@samrose samrose self-assigned this Apr 5, 2024
@samrose samrose added the enhancement New feature or request label Apr 5, 2024
@garrettmichaelgeorge
Copy link

garrettmichaelgeorge commented May 10, 2024

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.

@samrose
Copy link
Contributor Author

samrose commented May 10, 2024

@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

@workingjubilee
Copy link

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.

@samrose
Copy link
Contributor Author

samrose commented Jun 10, 2024

@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 .

@workingjubilee
Copy link

Nice!

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

@samrose
Copy link
Contributor Author

samrose commented Jul 31, 2024

#1076 closes

@samrose samrose closed this as completed Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants