Commit 96a2aea
Martin Häcker
·
2026-07-08 16:28:29 -0400 EDT
parent 6fabec0
Fix darwin build (#190) This modifies the build so the flake builds correctly on darwin. `nix flake show` still creates an IFD in the zig2nix flake, but that was a problem before and could be solved by setting pname and version in the package - so nothing that got worse with this patch.
1 files changed,
+25,
-6
+25,
-6
1@@ -10,7 +10,7 @@
2 let
3 flake-utils = zig2nix.inputs.flake-utils;
4 in
5- (flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (
6+ (flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ] (
7 system:
8 let
9 env = zig2nix.outputs.zig-env.${system} {
10@@ -20,11 +20,30 @@
11 with builtins;
12 with env.pkgs.lib;
13 let
14- zmx-package = env.package {
15- src = cleanSource ./.;
16- zigBuildFlags = [ "-Doptimize=ReleaseSafe" ];
17- zigPreferMusl = true;
18- };
19+ isDarwin = env.pkgs.stdenv.hostPlatform.isDarwin;
20+ sdkRoot = env.pkgs.apple-sdk.sdkroot;
21+ xcrunWrapper = env.pkgs.writeShellScriptBin "xcrun" ''
22+ echo "${sdkRoot}"
23+ '';
24+ xcodeselectWrapper = env.pkgs.writeShellScriptBin "xcode-select" ''
25+ echo "${sdkRoot}"
26+ '';
27+
28+ zmx-package = env.package (
29+ {
30+ src = cleanSource ./.;
31+ zigBuildFlags = [ "-Doptimize=ReleaseSafe" ];
32+ zigPreferMusl = !isDarwin;
33+ }
34+ // optionalAttrs isDarwin {
35+ glibc = null;
36+ musl = null;
37+ nativeBuildInputs = [
38+ xcrunWrapper
39+ xcodeselectWrapper
40+ ];
41+ }
42+ );
43 in
44 {
45 packages = {