-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: update devenv file for better building * fix: remove redundant files
- Loading branch information
Showing
1 changed file
with
44 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,51 @@ | ||
{ pkgs, lib, config, inputs, ... }: | ||
|
||
{ | ||
languages.java.jdk.package = pkgs.jdk21; | ||
languages.scala.package = pkgs.scala; | ||
languages.scala.enable = true; | ||
languages.scala.sbt.package = pkgs.sbt; | ||
languages.scala.sbt.enable = true; | ||
languages.scala.enable = true; | ||
languages.scala.sbt.enable = true; | ||
|
||
packages = [ pkgs.curl pkgs.git ]; | ||
packages = [ pkgs.curl pkgs.git pkgs.jdk21 pkgs.scala pkgs.sbt ]; | ||
|
||
processes = { | ||
sbt-package.exec = "sbt packageAll; exit"; | ||
}; | ||
env = { | ||
VSYS_JAR_FILE = "./target/vsys-all-0.4.2.jar"; | ||
VSYS_CONF_FILE = "./vsys-mainnet.conf"; | ||
}; | ||
|
||
enterShell = '' | ||
echo "SBT environment" | ||
''; | ||
processes = { | ||
build.exec = '' | ||
if [ ! -e "$VSYS_JAR_FILE" ]; then | ||
sbt packageAll | ||
else echo "Jar file already exists, skipping build..."; | ||
fi''; | ||
|
||
run.exec = '' | ||
echo "Waiting for jar file to be built..."; | ||
while [ ! -e "$VSYS_JAR_FILE" ]; do | ||
sleep 1; | ||
done; | ||
sleep 5; | ||
echo "Starting VSYS node..."; | ||
for attempt in seq 1 5; do | ||
java -jar $VSYS_JAR_FILE $VSYS_CONF_FILE; | ||
if [ $? -eq 0 ]; then | ||
break; | ||
fi; | ||
if [ $attempt -eq 1 ]; then | ||
echo "Failed to start VSYS node, retrying..."; | ||
fi; | ||
if [ $attempt -eq 5 ]; then | ||
echo "Failed to start VSYS node, exiting..."; | ||
exit 1; | ||
fi; | ||
sleep 5; | ||
done''; | ||
}; | ||
|
||
enterShell = '' | ||
echo "SBT environment" | ||
''; | ||
} |