depot/nixos/tests/darling.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

44 lines
1.1 KiB
Nix

import ./make-test-python.nix ({ pkgs, lib, ... }:
let
# Well, we _can_ cross-compile from Linux :)
hello = pkgs.runCommand "hello" {
sdk = "${pkgs.darling.sdk}/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk";
nativeBuildInputs = with pkgs.llvmPackages_14; [ clang-unwrapped lld ];
src = pkgs.writeText "hello.c" ''
#include <stdio.h>
int main() {
printf("Hello, Darling!\n");
return 0;
}
'';
} ''
clang \
-target x86_64-apple-darwin \
-fuse-ld=lld \
-nostdinc -nostdlib \
-mmacosx-version-min=10.15 \
--sysroot $sdk \
-isystem $sdk/usr/include \
-L $sdk/usr/lib -lSystem \
$src -o $out
'';
in
{
name = "darling";
meta.maintainers = with lib.maintainers; [ zhaofengli ];
nodes.machine = {
programs.darling.enable = true;
};
testScript = ''
start_all()
# Darling holds stdout until the server is shutdown
machine.succeed("darling ${hello} >hello.out")
machine.succeed("grep Hello hello.out")
machine.succeed("darling shutdown")
'';
})