Initial nix ad-hoc package installation
This commit is contained in:
parent
10183d0638
commit
8e230befce
35
flake.nix
35
flake.nix
|
@ -10,32 +10,27 @@
|
||||||
args = {
|
args = {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
piston = {
|
piston = {
|
||||||
mkRuntime = {
|
mkRuntime = builderFn: let
|
||||||
language,
|
languagePackagesFn = packages: with packages; [ ];
|
||||||
version,
|
buildRes = builderFn languagePackagesFn;
|
||||||
runtime? null,
|
compileFile = if builtins.hasAttr "compile" buildRes then
|
||||||
run,
|
pkgs.writeShellScript "compile" buildRes.compile
|
||||||
compile? null,
|
|
||||||
packages? null,
|
|
||||||
aliases? [],
|
|
||||||
limitOverrides? {},
|
|
||||||
tests
|
|
||||||
}: let
|
|
||||||
compileFile = if compile != null then
|
|
||||||
pkgs.writeShellScript "compile" compile
|
|
||||||
else null;
|
else null;
|
||||||
runFile = pkgs.writeShellScript "run" run;
|
runFile = pkgs.writeShellScript "run" buildRes.run;
|
||||||
metadata = {
|
metadata = {
|
||||||
inherit language version runtime aliases limitOverrides;
|
language = buildRes.language;
|
||||||
|
version = buildRes.version;
|
||||||
|
runtime = buildRes.runtime or null;
|
||||||
|
aliases = buildRes.aliases or [];
|
||||||
|
limitOverrides = buildRes.limitOverrides or {};
|
||||||
run = runFile;
|
run = runFile;
|
||||||
compile = compileFile;
|
compile = compileFile;
|
||||||
packageSupport = packages != null;
|
|
||||||
};
|
};
|
||||||
|
tests = if (builtins.length buildRes.tests) > 0 then
|
||||||
|
buildRes.tests
|
||||||
|
else abort "Language ${buildRes.language} doesn't provide any tests";
|
||||||
in {
|
in {
|
||||||
inherit packages metadata;
|
inherit metadata tests;
|
||||||
tests = if (builtins.length tests) > 0 then
|
|
||||||
tests
|
|
||||||
else abort "Language ${language} doesn't provide any tests";
|
|
||||||
};
|
};
|
||||||
mkTest = {
|
mkTest = {
|
||||||
files,
|
files,
|
||||||
|
|
2
piston
2
piston
|
@ -94,7 +94,7 @@ case "$SUBCOMMAND" in
|
||||||
-e PISTON_RUNTIME_SET=$runtime_set \
|
-e PISTON_RUNTIME_SET=$runtime_set \
|
||||||
-v "$SCRIPT_DIR":/piston/src \
|
-v "$SCRIPT_DIR":/piston/src \
|
||||||
-v $DEV_VOLUME_NAME:/nix \
|
-v $DEV_VOLUME_NAME:/nix \
|
||||||
-d "$IMAGE_NAME_DEV:$IMAGE_TAG" \
|
"$IMAGE_NAME_DEV:$IMAGE_TAG" \
|
||||||
bash -c "cd /piston/src/api && yarn run dev"
|
bash -c "cd /piston/src/api && yarn run dev"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
{ pkgs, piston, ... }:
|
{ pkgs, piston, ... }:
|
||||||
let
|
let basePkg = pkgs.python3;
|
||||||
pkg = pkgs.python3;
|
in piston.mkRuntime (libraries:
|
||||||
in piston.mkRuntime {
|
let pkg = basePkg.withPackages libraries;
|
||||||
|
in {
|
||||||
language = "python3";
|
language = "python3";
|
||||||
version = pkg.version;
|
version = basePkg.version;
|
||||||
|
|
||||||
aliases = [
|
aliases = [ "py3" "py" "python" ];
|
||||||
"py3"
|
|
||||||
"py"
|
|
||||||
"python"
|
|
||||||
];
|
|
||||||
|
|
||||||
run = ''
|
run = ''
|
||||||
${pkg}/bin/python3 "$@"
|
${pkg}/bin/python3 "$@"
|
||||||
|
@ -24,4 +21,4 @@ in piston.mkRuntime {
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
}
|
})
|
||||||
|
|
Loading…
Reference in New Issue