add piston nix pkg for gcc-c++

This commit is contained in:
Dan Vargas 2022-02-16 10:27:11 -07:00
parent 6297b0bcad
commit 28dca3ec44
2 changed files with 43 additions and 0 deletions

View File

@ -46,4 +46,5 @@ args: {
"groovy" = import ./groovy.nix args; "groovy" = import ./groovy.nix args;
"go" = import ./go.nix args; "go" = import ./go.nix args;
"gcc-c" = import ./gcc-c.nix args; "gcc-c" = import ./gcc-c.nix args;
"gcc-c++" = import ./gcc-c++.nix args;
} }

42
runtimes/gcc-c++.nix Normal file
View File

@ -0,0 +1,42 @@
{pkgs, piston, ...}:
let
pkg = pkgs.gcc;
in piston.mkRuntime {
language = "c++";
version = pkg.version;
runtime = "gcc";
aliases = [
"cpp"
"g++"
];
compile = ''
rename 's/$/\.cpp/' "$@" # Add .cpp extension
${pkg}/bin/g++ -std=c++17 *.cpp
'';
run = ''
shift
./a.out "$@"
'';
tests = [
(piston.mkTest {
files = {
"test.cpp" = ''
#include <iostream>
int main(void) {
printf("OK");
return 0;
}
'';
};
args = [];
stdin = "";
packages = [];
main = "test.cpp";
})
];
}