BREAKING: replace custom build scripts with nix

General:
- Switched to yarn to better work with nix-based tooling
- Switched package system to use nix. This stops double dependencies and slow cloud compile times, while providing more compile/runtime support to the Nix project
- Removed container builder in favor of internal container tooling
- Package versions no-longer need to be SemVer compliant
- Removed "piston package spec" files, replaced with nix-flake based runtimes
- Exported nosocket and piston-api as packages within the nix-flake
- Removed repo container
- Switched docker building to nix-based container outputting
- Removed docker compose as this is a single container
- Removed package commands from CLI

Packages:
- Move bash, clojure, cobol, node, python2, python3 to new format
- Remainder of packages still need to be moved

v2 API:
- Removed "version" specifier. To select specific versions, use the v3 api
- Removed "/package" endpoints as this doesn't work with the new nix-based system

v3 API:
- Duplicate of v2 API, except instead of passing in a language name an ID is used intead.
This commit is contained in:
Thomas Hobson 2022-01-30 18:41:24 +13:00
parent e06b59d82c
commit 564da5a7eb
No known key found for this signature in database
GPG key ID: 9F1FD9D87950DB6F
110 changed files with 2293 additions and 2793 deletions

65
runtimes/.scaffold.nix Normal file
View file

@ -0,0 +1,65 @@
{pkgs, piston, ...}:
let
# Put your package here, preferibly from nixpkgs.
pkg = pkgs.%RUNTIME%; # this may be incorrect - it is guessed
in piston.mkRuntime {
# Name of the language implemented by this runtime
language = "%LANGUAGE%";
# The version of the language
# Usually this is specified on the package
version = pkg.version;
# Name of the runtime
# This line should be kept if the runtime differs from the language
runtime = "%RUNTIME%";
aliases = [
# Put extensions in here, and other common names
# Example:
# "js"
# "node-javascript"
];
# This is the lines of a shell script to compile source code.
# Arguments passed to this script are all the provided source files
# The CWD of this script is a temp directory for a job
#
# If the language only supports JIT compiling, simply remove this line
# See ./python3.nix and ./node-javascript.nix for examples
#
# No shebang needs to be added to this - that is done automatically.
compile = ''
${pkg}/bin/%RUNTIME% --compile "$@"
'';
# This is the lines of a shell script to evaluate a file at $1
# The remaining arguments are the arguments to launch the application with
# The CWD of this script is a temp directory for a job
#
# If the compile stage is used, $1 still contains the name of the source file.
# It is up to your script to determine the filename of the emitted binary
#
# No shebang needs to be added to this - that is done automatically.
run = ''
${pkg}/bin/%RUNTIME% "$@"
'';
# Specify a list of tests.
# These should output "OK" to STDOUT if everything looks good
tests = [
(piston.mkTest {
files = {
"test.js" = ''
console.log("OK");
'';
};
args = [];
stdin = "";
packages = [];
main = "test.js";
})
];
}