686ce24904
GitOrigin-RevId: ac1f5b72a9e95873d1de0233fddcb56f99884b37
35 lines
953 B
Nix
35 lines
953 B
Nix
{ runCommand, lib, cosmopolitan }:
|
|
|
|
let
|
|
cosmocc =
|
|
runCommand "cosmocc"
|
|
{
|
|
pname = "cosmocc";
|
|
inherit (cosmopolitan) version;
|
|
|
|
meta = with lib; {
|
|
homepage = "https://justine.lol/cosmopolitan/";
|
|
description = "compilers for Cosmopolitan C/C++ programs";
|
|
license = licenses.mit;
|
|
maintainers = teams.cosmopolitan.members;
|
|
};
|
|
passthru.tests = {
|
|
cc = runCommand "c-test" { } ''
|
|
cat > hello.c << END
|
|
#include <stdio.h>
|
|
int main() {
|
|
printf("Hello world!\n");
|
|
return 0;
|
|
}
|
|
END
|
|
${cosmocc}/bin/cosmocc hello.c
|
|
./a.out > $out
|
|
'';
|
|
};
|
|
} ''
|
|
mkdir -p $out/bin
|
|
install ${cosmopolitan.dist}/tool/scripts/{cosmocc,cosmoc++} $out/bin
|
|
sed 's|/opt/cosmo\([ /]\)|${cosmopolitan.dist}\1|g' -i $out/bin/*
|
|
'';
|
|
in
|
|
cosmocc
|