mirror of
https://github.com/engineer-man/piston.git
synced 2025-05-06 20:06:27 +02:00
Merge pull request #441 from Brikaa/nix-development
Use nodemon and Docker volumes for development
This commit is contained in:
commit
16e4f08dfa
6 changed files with 801 additions and 92 deletions
|
@ -1,4 +1,4 @@
|
|||
{pkgs, nosocket, ...}:
|
||||
{pkgs, nosocket, isDev, ...}:
|
||||
with pkgs; rec {
|
||||
package = mkYarnPackage {
|
||||
name = "piston";
|
||||
|
@ -25,36 +25,54 @@ with pkgs; rec {
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
basePackages = with pkgs; [
|
||||
package
|
||||
nosocket
|
||||
bash
|
||||
nixFlakes
|
||||
coreutils-full
|
||||
cacert.out
|
||||
git
|
||||
gnutar
|
||||
gzip
|
||||
gnugrep
|
||||
rename
|
||||
util-linux
|
||||
];
|
||||
devPackages = with pkgs; [
|
||||
nodejs-16_x
|
||||
yarn
|
||||
python3
|
||||
gcc
|
||||
gnumake
|
||||
gnused
|
||||
];
|
||||
|
||||
baseCommands = ''
|
||||
mkdir -p piston/{jobs,runtimes} 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
|
||||
|
||||
chmod 1777 {,var/}tmp/
|
||||
'';
|
||||
devCommands = ''
|
||||
mkdir -p usr/bin
|
||||
ln -s /bin/env usr/bin/env
|
||||
chmod -R 1777 usr
|
||||
'';
|
||||
|
||||
container = pkgs.dockerTools.buildLayeredImageWithNixDb {
|
||||
name = "piston";
|
||||
name = if isDev then "piston" else "ghcr.io/engineer-man/piston";
|
||||
tag = "base-latest";
|
||||
|
||||
contents = with pkgs; [
|
||||
package
|
||||
nosocket
|
||||
bash
|
||||
nixFlakes
|
||||
coreutils-full
|
||||
cacert.out
|
||||
git
|
||||
gnutar
|
||||
gzip
|
||||
gnugrep
|
||||
rename
|
||||
util-linux
|
||||
];
|
||||
contents = if isDev then basePackages ++ devPackages else basePackages;
|
||||
|
||||
extraCommands = ''
|
||||
mkdir -p piston/{jobs,runtimes} 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
|
||||
|
||||
chmod 1777 {,var/}tmp/
|
||||
'';
|
||||
extraCommands = if isDev then baseCommands + devCommands else baseCommands;
|
||||
|
||||
config = {
|
||||
Cmd = ["${package}/bin/pistond"];
|
||||
|
@ -86,4 +104,4 @@ with pkgs; rec {
|
|||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,18 +8,20 @@
|
|||
"express": "^4.17.1",
|
||||
"express-ws": "^5.0.2",
|
||||
"logplease": "^1.2.15",
|
||||
"nocamel": "git://github.com/HexF/nocamel.git#patch-1",
|
||||
"node-fetch": "^2.6.1",
|
||||
"uuid": "^8.3.2",
|
||||
"nocamel": "git://github.com/HexF/nocamel.git#patch-1",
|
||||
"waitpid": "git://github.com/HexF/node-waitpid.git"
|
||||
},
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"dev": "nodemon .",
|
||||
"lint": "prettier . --write",
|
||||
"prepack": "yarn2nix > yarn.nix"
|
||||
},
|
||||
"devDependencies": {
|
||||
"node2nix": "^1.6.0",
|
||||
"nodemon": "^2.0.15",
|
||||
"prettier": "2.2.1"
|
||||
},
|
||||
"bin": {
|
||||
|
|
665
api/yarn.lock
665
api/yarn.lock
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue