diff --git a/api/src/bin/pistond.js b/api/src/bin/pistond.js index c56cc99..9c0c2f0 100755 --- a/api/src/bin/pistond.js +++ b/api/src/bin/pistond.js @@ -39,9 +39,13 @@ expressWs(app); logger.info('Loading packages'); - const runtimes_data = cp.execSync(`nix eval --json ${config.flake_path}#pistonRuntimeSets.${config.runtime_set} --apply builtins.attrNames`).toString(); + const runtimes_data = cp + .execSync( + `nix eval --json ${config.flake_path}#pistonRuntimeSets.${config.runtime_set} --apply builtins.attrNames` + ) + .toString(); const runtimes = JSON.parse(runtimes_data); - + runtimes.for_each(pkg => runtime.load_runtime(pkg)); logger.info('Starting API Server'); diff --git a/flake.nix b/flake.nix index fde9cee..6ecdda3 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "Piston packages repo"; inputs.nixpkgs.url = "github:NixOS/nixpkgs"; - outputs = { self, nixpkgs }: + outputs = { self, nixpkgs }: let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; @@ -66,6 +66,7 @@ pistonRuntimeSets = { "all" = runtimes; "bash-only" = runtimeList ["bash"]; + "none" = { }; }; legacyPackages."${system}" = rec { @@ -73,6 +74,6 @@ piston = (import ./api { inherit pkgs nosocket; }).package; }; - container = baseContainer; + container = baseContainer; }; } diff --git a/piston b/piston index 4ac46bd..5460a2a 100755 --- a/piston +++ b/piston @@ -12,7 +12,8 @@ SUBCOMMAND="$1" shift build_base(){ - CONTAINER_PATH="$(nix build ".#container" --no-link --json | jq '.[0].outputs.out' -r)" || exit 1 + CONTAINER_PATH="$(nix build ".#container" --no-link --json | jq '.[0].outputs.out' -r)" + echo "The image archive was created at: $CONTAINER_PATH" docker load -i $CONTAINER_PATH || exit 1 docker tag "$IMAGE_NAME_DEV:$IMAGE_TAG" "$IMAGE_NAME:$IMAGE_TAG" || exit 1 } @@ -39,7 +40,7 @@ case "$SUBCOMMAND" in # dev commands scaffold) - pushd $SCRIPT_DIR/runtimes > /dev/null + pushd "$SCRIPT_DIR"/runtimes > /dev/null ./scaffold.sh $1 $2 popd > /dev/null ;; @@ -50,7 +51,7 @@ case "$SUBCOMMAND" in # $1 contains a variant to build docker build \ --build-arg RUNTIMESET=$1 \ - -f $SCRIPT_DIR/Dockerfile.withset \ + -f "$SCRIPT_DIR"/Dockerfile.withset \ -t "$IMAGE_NAME_DEV:$1-latest" \ . fi @@ -70,7 +71,7 @@ case "$SUBCOMMAND" in -e PISTON_LOG_LEVEL=DEBUG \ -e PISTON_FLAKE_PATH=/piston/packages \ -e PISTON_RUNTIME_SET=$runtime_set \ - -v $PWD:/piston/packages \ + -v "$SCRIPT_DIR":/piston/packages \ -d "$IMAGE_NAME_DEV:$IMAGE_TAG" ;; @@ -80,9 +81,9 @@ case "$SUBCOMMAND" in --rm \ -it \ -e PISTON_FLAKE_PATH=/piston/packages \ - -v $PWD:/piston/packages \ + -v "$SCRIPT_DIR":/piston/packages \ --name piston_test_runner \ - -it "$IMAGE_NAME_DEV:$IMAGE_TAG" \ + "$IMAGE_NAME_DEV:$IMAGE_TAG" \ piston-test $1 ;;