mirror of
https://github.com/engineer-man/piston.git
synced 2025-04-20 20:16:26 +02:00
Add rust 1.57.0
This commit is contained in:
parent
6161997f49
commit
a739cff448
14 changed files with 48 additions and 58 deletions
|
@ -52,4 +52,5 @@ args: {
|
|||
"yabasic" = import ./yabasic.nix args;
|
||||
"emacs" = import ./emacs.nix args;
|
||||
"gnat-ada" = import ./gnat-ada.nix args;
|
||||
"rust" = import ./rust.nix args;
|
||||
}
|
||||
|
|
47
runtimes/rust.nix
Normal file
47
runtimes/rust.nix
Normal file
|
@ -0,0 +1,47 @@
|
|||
{pkgs, piston, ...}:
|
||||
let
|
||||
gccPackage = pkgs.gcc; # gcc is required for the linker
|
||||
pkg = pkgs.rustc;
|
||||
in piston.mkRuntime {
|
||||
language = "rust";
|
||||
version = pkg.version;
|
||||
|
||||
aliases = [
|
||||
"rs"
|
||||
];
|
||||
|
||||
compile = ''
|
||||
${pkg}/bin/rustc -o binary -C linker=${gccPackage}/bin/gcc $1
|
||||
chmod +x binary
|
||||
'';
|
||||
|
||||
run = ''
|
||||
shift
|
||||
./binary "$@"
|
||||
'';
|
||||
|
||||
tests = [
|
||||
(piston.mkTest {
|
||||
files = {
|
||||
"test.rs" = ''
|
||||
pub mod helper;
|
||||
use std::env;
|
||||
|
||||
fn main() {
|
||||
let args: Vec<String> = env::args().collect();
|
||||
helper::print_something(args[1].to_string());
|
||||
}
|
||||
'';
|
||||
"helper.rs" = ''
|
||||
pub fn print_something(what: String) -> () {
|
||||
println!("{}", what);
|
||||
}
|
||||
'';
|
||||
};
|
||||
args = ["OK"];
|
||||
stdin = "";
|
||||
packages = [];
|
||||
main = "test.rs";
|
||||
})
|
||||
];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue