at 24.11-pre 1.1 kB view raw
1import ./make-test-python.nix ({ pkgs, lib, ... }: 2 3let 4 # Well, we _can_ cross-compile from Linux :) 5 hello = pkgs.runCommand "hello" { 6 sdk = "${pkgs.darling.sdk}/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"; 7 nativeBuildInputs = with pkgs.llvmPackages_14; [ clang-unwrapped lld ]; 8 src = pkgs.writeText "hello.c" '' 9 #include <stdio.h> 10 int main() { 11 printf("Hello, Darling!\n"); 12 return 0; 13 } 14 ''; 15 } '' 16 clang \ 17 -target x86_64-apple-darwin \ 18 -fuse-ld=lld \ 19 -nostdinc -nostdlib \ 20 -mmacosx-version-min=10.15 \ 21 --sysroot $sdk \ 22 -isystem $sdk/usr/include \ 23 -L $sdk/usr/lib -lSystem \ 24 $src -o $out 25 ''; 26in 27{ 28 name = "darling"; 29 30 meta.maintainers = with lib.maintainers; [ zhaofengli ]; 31 32 nodes.machine = { 33 programs.darling.enable = true; 34 }; 35 36 testScript = '' 37 start_all() 38 39 # Darling holds stdout until the server is shutdown 40 machine.succeed("darling ${hello} >hello.out") 41 machine.succeed("grep Hello hello.out") 42 machine.succeed("darling shutdown") 43 ''; 44})