Hello everybody,
I am currently trying to setup a dev shell for developing a cross platform zig project. I use the zig-overlay
from mitchellh
and got it working for linux and windows no problem.
Now I am at a stage, where I need to compile some objective-c for macos, and need to link to their frameworks for that. I found, that for nix there exists the apple-sdk
package. Now the problem is, I need to compile for aarch64
, but I couldn’t figure out how I can include the apple-sdk
for that architecture.
This is what I have came up with after trying and failing for a while:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
zig.url = "github:mitchellh/zig-overlay";
};
outputs = { self, nixpkgs, flake-utils, zig }:
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs {
inherit system;
};
aarch64-darwin-packages = import nixpkgs {
crossSystem = { config = "aarch64-darwin"; };
inherit system;
};
in
{
devShells.default = pkgs.mkShellNoCC {
name = "nix-rat-dev";
packages = with pkgs; [
zig.packages.${system}."0.13.0"
zls
aarch64-darwin-packages.apple-sdk_15
];
};
}
);
}
This is how I activate it:
NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 nix develop --impure -c $SHELL
(I also wouldn’t mind losing the --impure
and NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1
parts)
But it fails with the following:
error:
… while calling the 'derivationStrict' builtin
at <nix/derivation-internal.nix>:34:12:
33|
34| strict = derivationStrict drvAttrs;
| ^
35|
… while evaluating derivation 'nix-rat-dev'
whose name attribute is located at /nix/store/pgg4vm83q0kr4hxzcwhdgdiv2yfnh3dw-source/pkgs/stdenv/generic/make-derivation.nix:375:7
… while evaluating attribute 'nativeBuildInputs' of derivation 'nix-rat-dev'
at /nix/store/pgg4vm83q0kr4hxzcwhdgdiv2yfnh3dw-source/pkgs/stdenv/generic/make-derivation.nix:419:7:
418| depsBuildBuild = elemAt (elemAt dependencies 0) 0;
419| nativeBuildInputs = elemAt (elemAt dependencies 0) 1;
| ^
420| depsBuildTarget = elemAt (elemAt dependencies 0) 2;
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: assertion '((pkgs).stdenv.cc.libcxx != null)' failed
at /nix/store/pgg4vm83q0kr4hxzcwhdgdiv2yfnh3dw-source/pkgs/stdenv/adapters.nix:57:5:
56| assert stdenv.cc.libcxx != null;
57| assert pkgs.stdenv.cc.libcxx != null;
| ^
58| # only unified libcxx / libcxxabi stdenv's are supported
And I couldn’t really make heads or tails from that.
I would really appreciate your help.