Code change:
Darling is a compatibility layer for running macOS apps on Linux (think Wine for macOS). I think it would be interesting to work on with macOS support. They have reverse engineered some headers that Apple doesn't release publicly so having them in "libdarling" could be useful.
We already have this part:
Just heard of Darling. I would be delighted if it could be used for running builds on NixOS!
It seem to be packaged by but only for macOS. If i understand the project correctly, that makes no sense. We want it on linux, to run macOS apps. Also, the package has no version. That's probably because they havn't tagged a version yet. So this is pre-alpha state software. could you update the package to the commit the "stable" AUR package uses and add a version as described here: ? Then we can close this issue.
It looks like the project has started using tagged versions:
Thank you for your contributions. This has been automatically marked as stale because it has had no activity for 180 days. If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity. Here are suggestions that might help resolve this more quickly: for maintainers and people that previously touched the related code and @ mention them in a comment. on the . 3. Ask on the on .
I'd still be very interested in seeing this , especially with the hope of future cross-compilation support
This would even make it possible to package Mac binaries for Linux!
I'm interested in this so that I can test cross compiled binaries when running tests.
I marked this as stale due to inactivity. &rarr;
Not stale!!
darling-dmg is just part of . To be exact, it is included as a submodule in the source tree of darling. The darling build will come with kernel modules. It would need someone with kernel-packaging experience to pack it into Nixpkgs. Build instructions in the Darling Docs:
I marked this as stale due to inactivity. &rarr;
I'd still like to see this, though largely for much the same reason Andrew mentions at this point -- I've started working with zig and being able to test cross-compiled macos binaries would be brilliant.
I have got most of a Darling build file running, but I have found an interesting issue. Wever I build I get the following error: From this cmake file: As far as I can tell, the command is a special MacOS thing, and I unfortunately do not understand CMake well enough to fix it...
Well, turns out the issue is that Darling relies on git-submodules, and it looks like this must be built against the Git repo directly, not against the released tarball...
What would therefore be a derivation?
What do you mean It's just a with .
I tried to re-package the prebuilt deb from darling GitHub releases. Here is the nix code darling- Save these 2 snippets as and darling-, then run . With 2 problems: needs setuid/setgid perms, while nix-build would fail if dpkg-deb -x executed directly. I use fakeroot to ignore this problem. always fails. I am not a darling expert, have no idea.
Ah, fantastic, thanks! Looking forward to having this in nixpkgs anyway, but let's see how we go there.
It could be named when entering Nixpkgs.
Good suggestion. I've edited those two scripts.
I got as far as finding out that darlingserver doesn't start with that script because it expects /usr/bin, so updating my to a version, the next issue was that darlingserver was trying to mount overlayfs on "lowerdir=/usr/libexec/darling,up" (may be incomplete, this is strace output) which did not exist.
After a bit of tinkering I got Darling to build from source. I opened with more info. Please give it a try!
It seems that they now use instead of the kernel module. This would make packaging easier.
What's the purpose of ? If it is only the sandbox part of Darling, a new name like would bring less confusion. Update: Opened PR to do the renaming.

Related discussion:
text: <ins> { clangStdenv , lib , runCommandWith , writeShellScript , fetchFromGitHub , fetchpatch , freetype , libjpeg , libpng , libtiff , giflib , libX11 , libXext , libXrandr , libXcursor , libxkbfile , cairo , libglvnd , fontconfig , dbus , libGLU , fuse , ffmpeg , pulseaudio , makeWrapper , python2 , python3 , cmake , ninja , pkg-config , bison , flex , libbsd , openssl , xdg-user-dirs , addOpenGLRunpath # Whether to pre-compile Python 2 bytecode for performance. , compilePy2Bytecode ? false }: let stdenv = clangStdenv; # The build system invokes clang to compile Darwin executables. # In this case, our cc-wrapper must not be used. ccWrapperBypass = runCommandWith { inherit stdenv; name = "cc-wrapper-bypass"; runLocal = false; derivationArgs = { template = writeShellScript "template" '' for (( i=1; i<=$#; i++)); do j=$((i+1)) if [[ "''${!i}" == "-target" && "''${!j}" == *"darwin"* ]]; then # their flags must take precedence exec @unwrapped@ "$@" $NIX_CFLAGS_COMPILE fi done exec @wrapped@ "$@" ''; }; } '' unwrapped_bin=${stdenv.cc.cc}/bin wrapped_bin=${stdenv.cc}/bin mkdir -p $out/bin unwrapped=$unwrapped_bin/$CC wrapped=$wrapped_bin/$CC  substituteAll $template $out/bin/$CC unwrapped=$unwrapped_bin/$CXX wrapped=$wrapped_bin/$CXX  substituteAll $template $out/bin/$CXX chmod +x $out/bin/$CC $out/bin/$CXX ''; wrappedLibs = [ # To find all of them: rg -w wrap_elf # src/native/CMakeLists.txt freetype libjpeg libpng libtiff giflib libX11 libXext libXrandr libXcursor libxkbfile cairo libglvnd fontconfig dbus libGLU # src/external/darling-dmg/CMakeLists.txt fuse # src/CoreAudio/CMakeLists.txt ffmpeg pulseaudio ]; in stdenv.mkDerivation { pname = "darling"; version = "unstable-2023-05-02"; src = fetchFromGitHub { owner = "darlinghq"; repo = "darling"; rev = "557e7e9dece394a3f623825679474457e5b64fd0"; fetchSubmodules = true; hash = "sha256-SOoLaV7wg33qRHPQXkdMvrY++CvoG85kwd6IU6DkYa0="; }; outputs = [ "out" "sdk" ]; postPatch = '' # We have to be careful - Patching everything indiscriminately # would affect Darwin scripts as well chmod +x src/external/bootstrap_cmds/migcom.tproj/mig.sh patchShebangs  src/external/bootstrap_cmds/migcom.tproj/mig.sh  src/external/darlingserver/scripts  src/external/openssl_certificates/scripts substituteInPlace src/startup/CMakeLists.txt --replace SETUID "" substituteInPlace src/external/basic_cmds/CMakeLists.txt --replace SETGID "" ''; nativeBuildInputs = [ bison ccWrapperBypass cmake flex makeWrapper ninja pkg-config python3 ] ++ lib.optional compilePy2Bytecode python2; buildInputs = wrappedLibs ++ [ libbsd openssl stdenv.cc.libc.linuxHeaders ]; # Breaks valid paths like # Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include dontFixCmake = true; # src/external/objc4 forces OBJC_IS_DEBUG_BUILD=1, which conflicts with NDEBUG # TODO: Fix in a better way cmakeBuildType = " "; cmakeFlags = [ "-DTARGET_i386=OFF" "-DCOMPILE_PY2_BYTECODE=${if compilePy2Bytecode then "ON" else "OFF"}" "-DDARLINGSERVER_XDG_USER_DIR_CMD=${xdg-user-dirs}/bin/xdg-user-dir" ]; env.NIX_CFLAGS_COMPILE = "-Wno-macro-redefined -Wno-unused-command-line-argument"; # Linux .so's are dlopen'd by wrapgen during the build env.LD_LIBRARY_PATH = lib.makeLibraryPath wrappedLibs; # Breaks shebangs of Darwin scripts dontPatchShebangs = true; postInstall = '' # Install the SDK as a separate output mkdir -p $sdk sdkDir=$(readlink -f ../Developer) while read -r path; do dst="$sdk/Developer/''${path#$sdkDir}" if [[ -L "$path" ]]; then target=$(readlink -m "$path") if [[ -e "$target" && "$target" == "$NIX_BUILD_TOP"* && "$target" != "$sdkDir"* ]]; then # dereference cp -r -L "$path" "$dst" elif [[ -e "$target" ]]; then # preserve symlink cp -d "$path" "$dst" else # ignore symlink >&2 echo "Ignoring symlink $path -> $target" fi elif [[ -f $path ]]; then cp "$path" "$dst" elif [[ -d $path ]]; then mkdir -p "$dst" fi done < <(find $sdkDir) mkdir -p $sdk/bin cp src/external/cctools-port/cctools/ld64/src/*-ld $sdk/bin cp src/external/cctools-port/cctools/ar/*-{ar,ranlib} $sdk/bin ''; postFixup = '' echo "Checking for references to $NIX_STORE in Darling root..." set +e grep -r --exclude=mldr "$NIX_STORE" $out/libexec/darling ret=$? set -e if [[ $ret == 0 ]]; then echo "Found references to $NIX_STORE in Darling root (see above)" exit 1 fi patchelf --add-rpath "${lib.makeLibraryPath wrappedLibs}:${addOpenGLRunpath.driverLink}/lib"  $out/libexec/darling/usr/libexec/darling/mldr ''; meta = with lib; { description = "Open-source Darwin/macOS emulation layer for Linux"; homepage = "https://www.darlinghq.org"; license = licenses.gpl3Plus; maintainers = with maintainers; [ zhaofengli ]; platforms = [ "x86_64-linux" ]; }; } </ins>