mirror of
https://github.com/engineer-man/piston.git
synced 2025-06-09 03:26:27 +02:00
Add nix runtime testing and pre-installing runtimes
This commit is contained in:
parent
564da5a7eb
commit
e022e34a37
11 changed files with 306 additions and 176 deletions
67
flake.nix
67
flake.nix
|
@ -6,6 +6,10 @@
|
|||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
baseContainer = (import ./api {
|
||||
inherit pkgs;
|
||||
nosocket = self.legacyPackages."${system}".nosocket;
|
||||
}).container;
|
||||
args = {
|
||||
inherit pkgs;
|
||||
piston = {
|
||||
|
@ -53,66 +57,21 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
allRuntimes = import ./runtimes args;
|
||||
runtimes = import ./runtimes args;
|
||||
runtimeList = names: pkgs.lib.filterAttrs (n: v: n == "bash") runtimes;
|
||||
in {
|
||||
piston = args.piston;
|
||||
pistonRuntimes = {
|
||||
"bash" = allRuntimes.bash;
|
||||
pistonRuntimes = runtimes;
|
||||
pistonRuntimeSets = {
|
||||
"all" = runtimes;
|
||||
"bash-only" = runtimeList ["bash"];
|
||||
};
|
||||
|
||||
legacyPackages."${system}" = {
|
||||
piston = (import ./api { inherit pkgs; }).package;
|
||||
legacyPackages."${system}" = rec {
|
||||
nosocket = (import ./nosocket { inherit pkgs; }).package;
|
||||
piston = (import ./api { inherit pkgs nosocket; }).package;
|
||||
};
|
||||
|
||||
containerImage = pkgs.dockerTools.buildLayeredImageWithNixDb {
|
||||
name = "piston";
|
||||
tag = "latest";
|
||||
|
||||
contents = with pkgs; [
|
||||
self.legacyPackages."${system}".piston
|
||||
self.legacyPackages."${system}".nosocket
|
||||
bash
|
||||
nixFlakes
|
||||
coreutils-full
|
||||
cacert.out
|
||||
git
|
||||
gnutar
|
||||
gzip
|
||||
gnugrep
|
||||
util-linux
|
||||
];
|
||||
|
||||
extraCommands = ''
|
||||
mkdir -p piston/jobs etc/nix {,var/}tmp run/lock
|
||||
echo -e "experimental-features = nix-command flakes" >> etc/nix/nix.conf
|
||||
echo "nixbld:x:30000:nixbld1,nixbld10,nixbld11,nixbld12,nixbld13,nixbld14,nixbld15,nixbld16,nixbld17,nixbld18,nixbld19,nixbld2,nixbld20,nixbld21,nixbld22,nixbld23,nixbld24,nixbld25,nixbld26,nixbld27,nixbld28,nixbld29,nixbld3,nixbld30,nixbld31,nixbld32,nixbld4,nixbld5,nixbld6,nixbld7,nixbld8,nixbld9" >> etc/group
|
||||
for i in $(seq 1 32)
|
||||
do
|
||||
echo "nixbld$i:x:$(( $i + 30000 )):30000:Nix build user $i:/var/empty:/run/current-system/sw/bin/nologin" >> etc/passwd
|
||||
done
|
||||
'';
|
||||
|
||||
config = {
|
||||
Cmd = [
|
||||
"${self.legacyPackages."${system}".piston}/bin/pistond"
|
||||
];
|
||||
|
||||
Env = [
|
||||
"NIX_PAGER=cat"
|
||||
"USER=nobody"
|
||||
"SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt"
|
||||
"GIT_SSL_CAINFO=/etc/ssl/certs/ca-bundle.crt"
|
||||
"NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt"
|
||||
|
||||
];
|
||||
|
||||
ExposedPorts = {
|
||||
"2000/tcp" = {};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
container = baseContainer;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue