nixos/tests/darling: init

This commit is contained in:
Zhaofeng Li 2023-05-01 17:39:19 -06:00
parent 1e39c977f7
commit 4b8e060167
2 changed files with 45 additions and 0 deletions

View File

@ -171,6 +171,7 @@ in {
cups-pdf = handleTest ./cups-pdf.nix {};
custom-ca = handleTest ./custom-ca.nix {};
croc = handleTest ./croc.nix {};
darling = handleTest ./darling.nix {};
deepin = handleTest ./deepin.nix {};
deluge = handleTest ./deluge.nix {};
dendrite = handleTest ./matrix/dendrite.nix {};

44
nixos/tests/darling.nix Normal file
View File

@ -0,0 +1,44 @@
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_latest; [ 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")
'';
})