diff --git a/pkgs/development/tools/cosmocc/default.nix b/pkgs/development/tools/cosmocc/default.nix new file mode 100644 index 000000000000..71028d1a1968 --- /dev/null +++ b/pkgs/development/tools/cosmocc/default.nix @@ -0,0 +1,35 @@ +{ 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 + 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 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9bf74f533f8b..86bdd538cd92 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19293,6 +19293,8 @@ with pkgs; cog = callPackage ../development/web/cog { }; + cosmocc = callPackage ../development/tools/cosmocc { }; + cosmopolitan = callPackage ../development/libraries/cosmopolitan { }; python-cosmopolitan = callPackage ../development/interpreters/python-cosmopolitan { };