1 { lib, stdenv, fetchFromGitHub, unzip, bintools-unwrapped, coreutils, substituteAll }:
3 stdenv.mkDerivation rec {
4 pname = "cosmopolitan";
7 src = fetchFromGitHub {
11 sha256 = "sha256-2Q4lutSIQ6tBwTy01lPSMepNAww9Kb7BwNyEcsSdWZ0=";
15 # make sure tests set PATH correctly
16 (substituteAll { src = ./fix-paths.patch; inherit coreutils; })
19 nativeBuildInputs = [ bintools-unwrapped unzip ];
21 outputs = [ "out" "dist" ];
23 # slashes are significant because upstream uses o/$(MODE)/foo.o
24 buildFlags = [ "o/cosmopolitan.h" "o//cosmopolitan.a" "o//libc/crt/crt.o" "o//ape/ape.o" "o//ape/ape.lds" ];
25 checkTarget = "o//test";
26 enableParallelBuilding = true;
33 # some syscall tests fail because we're in a sandbox
34 rm test/libc/calls/sched_setscheduler_test.c
35 rm test/libc/thread/pthread_create_test.c
36 rm test/libc/calls/getgroups_test.c
41 mkdir -p $out/{include,lib}
42 install o/cosmopolitan.h $out/include
43 install o/cosmopolitan.a o/libc/crt/crt.o o/ape/ape.{o,lds} o/ape/ape-no-modify-self.o $out/lib
50 homepage = "https://justine.lol/cosmopolitan/";
51 description = "Your build-once run-anywhere c library";
52 platforms = platforms.x86_64;
53 badPlatforms = platforms.darwin;
54 license = licenses.isc;
55 maintainers = teams.cosmopolitan.members;