lol

darling: drop (#405727)

authored by

Jörg Thalheim and committed by
GitHub
5adbb5f7 393dfbdc

+1 -348
-1
nixos/modules/module-list.nix
··· 186 186 ./programs/corefreq.nix 187 187 ./programs/cpu-energy-meter.nix 188 188 ./programs/criu.nix 189 - ./programs/darling.nix 190 189 ./programs/dconf.nix 191 190 ./programs/digitalbitbox/default.nix 192 191 ./programs/direnv.nix
-27
nixos/modules/programs/darling.nix
··· 1 - { 2 - config, 3 - lib, 4 - pkgs, 5 - ... 6 - }: 7 - 8 - let 9 - cfg = config.programs.darling; 10 - in 11 - { 12 - options = { 13 - programs.darling = { 14 - enable = lib.mkEnableOption "Darling, a Darwin/macOS compatibility layer for Linux"; 15 - package = lib.mkPackageOption pkgs "darling" { }; 16 - }; 17 - }; 18 - 19 - config = lib.mkIf cfg.enable { 20 - security.wrappers.darling = { 21 - source = lib.getExe cfg.package; 22 - owner = "root"; 23 - group = "root"; 24 - setuid = true; 25 - }; 26 - }; 27 - }
-1
nixos/tests/all-tests.nix
··· 373 373 croc = handleTest ./croc.nix { }; 374 374 cross-seed = runTest ./cross-seed.nix; 375 375 cyrus-imap = runTest ./cyrus-imap.nix; 376 - darling = handleTest ./darling.nix { }; 377 376 darling-dmg = runTest ./darling-dmg.nix; 378 377 dae = handleTest ./dae.nix { }; 379 378 davis = runTest ./davis.nix;
-52
nixos/tests/darling.nix
··· 1 - import ./make-test-python.nix ( 2 - { pkgs, lib, ... }: 3 - 4 - let 5 - # Well, we _can_ cross-compile from Linux :) 6 - hello = 7 - pkgs.runCommand "hello" 8 - { 9 - sdk = "${pkgs.darling.sdk}/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"; 10 - nativeBuildInputs = with pkgs.llvmPackages_14; [ 11 - clang-unwrapped 12 - lld 13 - ]; 14 - src = pkgs.writeText "hello.c" '' 15 - #include <stdio.h> 16 - int main() { 17 - printf("Hello, Darling!\n"); 18 - return 0; 19 - } 20 - ''; 21 - } 22 - '' 23 - clang \ 24 - -target x86_64-apple-darwin \ 25 - -fuse-ld=lld \ 26 - -nostdinc -nostdlib \ 27 - -mmacosx-version-min=10.15 \ 28 - --sysroot $sdk \ 29 - -isystem $sdk/usr/include \ 30 - -L $sdk/usr/lib -lSystem \ 31 - $src -o $out 32 - ''; 33 - in 34 - { 35 - name = "darling"; 36 - 37 - meta.maintainers = with lib.maintainers; [ zhaofengli ]; 38 - 39 - nodes.machine = { 40 - programs.darling.enable = true; 41 - }; 42 - 43 - testScript = '' 44 - start_all() 45 - 46 - # Darling holds stdout until the server is shutdown 47 - machine.succeed("darling ${hello} >hello.out") 48 - machine.succeed("grep Hello hello.out") 49 - machine.succeed("darling shutdown") 50 - ''; 51 - } 52 - )
-267
pkgs/by-name/da/darling/package.nix
··· 1 - { 2 - clangStdenv, 3 - lib, 4 - runCommandWith, 5 - writeShellScript, 6 - fetchFromGitHub, 7 - fetchpatch, 8 - nixosTests, 9 - 10 - freetype, 11 - libjpeg, 12 - libpng, 13 - libtiff, 14 - giflib, 15 - libX11, 16 - libXext, 17 - libXrandr, 18 - libXcursor, 19 - libxkbfile, 20 - cairo, 21 - libglvnd, 22 - fontconfig, 23 - dbus, 24 - libGLU, 25 - fuse, 26 - ffmpeg, 27 - pulseaudio, 28 - 29 - makeWrapper, 30 - python2, 31 - python3, 32 - cmake, 33 - ninja, 34 - pkg-config, 35 - bison, 36 - flex, 37 - 38 - libbsd, 39 - openssl, 40 - 41 - xdg-user-dirs, 42 - 43 - addDriverRunpath, 44 - 45 - # Whether to pre-compile Python 2 bytecode for performance. 46 - compilePy2Bytecode ? false, 47 - }: 48 - let 49 - stdenv = clangStdenv; 50 - 51 - # The build system invokes clang to compile Darwin executables. 52 - # In this case, our cc-wrapper must not be used. 53 - ccWrapperBypass = 54 - runCommandWith 55 - { 56 - inherit stdenv; 57 - name = "cc-wrapper-bypass"; 58 - runLocal = false; 59 - derivationArgs = { 60 - template = writeShellScript "template" '' 61 - for (( i=1; i<=$#; i++)); do 62 - j=$((i+1)) 63 - if [[ "''${!i}" == "-target" && "''${!j}" == *"darwin"* ]]; then 64 - # their flags must take precedence 65 - exec @unwrapped@ "$@" $NIX_CFLAGS_COMPILE 66 - fi 67 - done 68 - exec @wrapped@ "$@" 69 - ''; 70 - }; 71 - } 72 - '' 73 - unwrapped_bin=${stdenv.cc.cc}/bin 74 - wrapped_bin=${stdenv.cc}/bin 75 - 76 - mkdir -p $out/bin 77 - 78 - unwrapped=$unwrapped_bin/$CC wrapped=$wrapped_bin/$CC \ 79 - substituteAll $template $out/bin/$CC 80 - unwrapped=$unwrapped_bin/$CXX wrapped=$wrapped_bin/$CXX \ 81 - substituteAll $template $out/bin/$CXX 82 - 83 - chmod +x $out/bin/$CC $out/bin/$CXX 84 - ''; 85 - 86 - wrappedLibs = [ 87 - # To find all of them: rg -w wrap_elf 88 - 89 - # src/native/CMakeLists.txt 90 - freetype 91 - libjpeg 92 - libpng 93 - libtiff 94 - giflib 95 - libX11 96 - libXext 97 - libXrandr 98 - libXcursor 99 - libxkbfile 100 - cairo 101 - libglvnd 102 - fontconfig 103 - dbus 104 - libGLU 105 - 106 - # src/external/darling-dmg/CMakeLists.txt 107 - fuse 108 - 109 - # src/CoreAudio/CMakeLists.txt 110 - ffmpeg 111 - pulseaudio 112 - ]; 113 - in 114 - stdenv.mkDerivation { 115 - pname = "darling"; 116 - version = "unstable-2024-02-03"; 117 - 118 - src = fetchFromGitHub { 119 - owner = "darlinghq"; 120 - repo = "darling"; 121 - rev = "25afbc76428c39c3909e9efcf5caef1140425211"; 122 - fetchSubmodules = true; 123 - hash = "sha256-z9IMgc5hH2Upn8wHl1OgP42q9HTSkeHnxB3N812A+Kc="; 124 - # Remove 500MB of dependency test files to get under Hydra output limit 125 - postFetch = '' 126 - rm -r $out/src/external/openjdk/test 127 - rm -r $out/src/external/libmalloc/tests 128 - rm -r $out/src/external/libarchive/libarchive/tar/test 129 - ''; 130 - }; 131 - 132 - outputs = [ 133 - "out" 134 - "sdk" 135 - ]; 136 - 137 - patches = [ 138 - # Fix 'clang: error: no such file or directory: .../signal/mach_excUser.c' 139 - # https://github.com/darlinghq/darling/issues/1511 140 - # https://github.com/darlinghq/darling/commit/f46eb721c11d32addd807f092f4b3a6ea515bb6d 141 - (fetchpatch { 142 - url = "https://github.com/darlinghq/darling/commit/f46eb721c11d32addd807f092f4b3a6ea515bb6d.patch?full_index=1"; 143 - hash = "sha256-FnLcHnK4cNto+E3OQSxE3iK+FHSU8y459FcpMvrzd6o="; 144 - }) 145 - 146 - # Fix compatibility with ffmpeg_7 147 - # https://github.com/darlinghq/darling/pull/1537 148 - # https://github.com/darlinghq/darling/commit/9655d5598c87dcb22c54a83cc7741b77cb47a1b0 149 - (fetchpatch { 150 - url = "https://github.com/darlinghq/darling/commit/9655d5598c87dcb22c54a83cc7741b77cb47a1b0.patch?full_index=1"; 151 - hash = "sha256-ogMo4SRRwiOhaVJ+OS8BVolGDa7vGKyR9bdGiOiCuRc="; 152 - }) 153 - ]; 154 - 155 - postPatch = '' 156 - # We have to be careful - Patching everything indiscriminately 157 - # would affect Darwin scripts as well 158 - chmod +x src/external/bootstrap_cmds/migcom.tproj/mig.sh 159 - patchShebangs \ 160 - src/external/bootstrap_cmds/migcom.tproj/mig.sh \ 161 - src/external/darlingserver/scripts \ 162 - src/external/openssl_certificates/scripts 163 - 164 - substituteInPlace src/startup/CMakeLists.txt --replace SETUID "" 165 - substituteInPlace src/external/basic_cmds/CMakeLists.txt --replace SETGID "" 166 - ''; 167 - 168 - nativeBuildInputs = [ 169 - bison 170 - ccWrapperBypass 171 - cmake 172 - flex 173 - makeWrapper 174 - ninja 175 - pkg-config 176 - python3 177 - ] ++ lib.optional compilePy2Bytecode python2; 178 - buildInputs = wrappedLibs ++ [ 179 - libbsd 180 - openssl 181 - stdenv.cc.libc.linuxHeaders 182 - ]; 183 - 184 - # Breaks valid paths like 185 - # Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include 186 - dontFixCmake = true; 187 - 188 - # src/external/objc4 forces OBJC_IS_DEBUG_BUILD=1, which conflicts with NDEBUG 189 - # TODO: Fix in a better way 190 - cmakeBuildType = " "; 191 - 192 - cmakeFlags = [ 193 - "-DTARGET_i386=OFF" 194 - "-DCOMPILE_PY2_BYTECODE=${if compilePy2Bytecode then "ON" else "OFF"}" 195 - "-DDARLINGSERVER_XDG_USER_DIR_CMD=${xdg-user-dirs}/bin/xdg-user-dir" 196 - ]; 197 - 198 - env.NIX_CFLAGS_COMPILE = "-Wno-macro-redefined -Wno-unused-command-line-argument"; 199 - 200 - # Linux .so's are dlopen'd by wrapgen during the build 201 - env.LD_LIBRARY_PATH = lib.makeLibraryPath wrappedLibs; 202 - 203 - # Breaks shebangs of Darwin scripts 204 - dontPatchShebangs = true; 205 - 206 - postInstall = '' 207 - # Install the SDK as a separate output 208 - mkdir -p $sdk 209 - 210 - sdkDir=$(readlink -f ../Developer) 211 - 212 - while read -r path; do 213 - dst="$sdk/Developer/''${path#$sdkDir}" 214 - 215 - if [[ -L "$path" ]]; then 216 - target=$(readlink -m "$path") 217 - if [[ -e "$target" && "$target" == "$NIX_BUILD_TOP"* && "$target" != "$sdkDir"* ]]; then 218 - # dereference 219 - cp -r -L "$path" "$dst" 220 - elif [[ -e "$target" ]]; then 221 - # preserve symlink 222 - cp -d "$path" "$dst" 223 - else 224 - # ignore symlink 225 - >&2 echo "Ignoring symlink $path -> $target" 226 - fi 227 - elif [[ -f $path ]]; then 228 - cp "$path" "$dst" 229 - elif [[ -d $path ]]; then 230 - mkdir -p "$dst" 231 - fi 232 - done < <(find $sdkDir) 233 - 234 - mkdir -p $sdk/bin 235 - cp src/external/cctools-port/cctools/ld64/src/*-ld $sdk/bin 236 - cp src/external/cctools-port/cctools/ar/*-{ar,ranlib} $sdk/bin 237 - ''; 238 - 239 - postFixup = '' 240 - echo "Checking for references to $NIX_STORE in Darling root..." 241 - 242 - set +e 243 - grep -r --exclude=mldr "$NIX_STORE" $out/libexec/darling 244 - ret=$? 245 - set -e 246 - 247 - if [[ $ret == 0 ]]; then 248 - echo "Found references to $NIX_STORE in Darling root (see above)" 249 - exit 1 250 - fi 251 - 252 - patchelf --add-rpath "${lib.makeLibraryPath wrappedLibs}:${addDriverRunpath.driverLink}/lib" \ 253 - $out/libexec/darling/usr/libexec/darling/mldr 254 - ''; 255 - 256 - passthru.tests.nixos = nixosTests.darling; 257 - 258 - meta = with lib; { 259 - description = "Open-source Darwin/macOS emulation layer for Linux"; 260 - homepage = "https://www.darlinghq.org"; 261 - changelog = "https://github.com/darlinghq/darling/releases"; 262 - license = licenses.gpl3Plus; 263 - maintainers = with maintainers; [ zhaofengli ]; 264 - platforms = [ "x86_64-linux" ]; 265 - mainProgram = "darling"; 266 - }; 267 - }
+1
pkgs/top-level/aliases.nix
··· 497 497 ### D ### 498 498 499 499 dap = throw "'dap' has been removed because it doesn't compile and has been unmaintained since 2014"; # Added 2025-05-10 500 + darling = throw "'darling' has been removed due to vendoring Python2"; # Added 2025-05-10 500 501 dart_stable = throw "'dart_stable' has been renamed to/replaced by 'dart'"; # Converted to throw 2024-10-17 501 502 dart-sass-embedded = throw "dart-sass-embedded has been removed from nixpkgs, as is now included in Dart Sass itself."; 502 503 dat = nodePackages.dat;