feat: Setup development environment
The environment includes java, maven, IntelliJ and a postgres server.
This commit is contained in:
parent
414504d225
commit
b2d1b1eb71
5 changed files with 214 additions and 0 deletions
70
devenv.nix
Normal file
70
devenv.nix
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
# https://devenv.sh/packages/
|
||||
packages = [
|
||||
pkgs.git
|
||||
pkgs.jetbrains.idea-community-bin
|
||||
];
|
||||
|
||||
languages.java.enable = true;
|
||||
languages.java.maven.enable = true;
|
||||
languages.nix.enable = true;
|
||||
|
||||
# https://devenv.sh/processes/
|
||||
# processes.cargo-watch.exec = "cargo-watch";
|
||||
|
||||
processes.flexinale-monolith.exec = ''
|
||||
java -Dspring.datasource.url=jdbc:postgresql://localhost:5432/monolith -jar flex-training-flexinale/flexinale-monolith/target/flexinale-monolith-2024.3.0-spring-boot-fat-jar.jar
|
||||
'';
|
||||
|
||||
# https://devenv.sh/services/
|
||||
services.postgres = {
|
||||
enable = true;
|
||||
listen_addresses = "127.0.0.1";
|
||||
initialScript =
|
||||
let
|
||||
createDB = n: ''
|
||||
CREATE DATABASE "${n}";
|
||||
GRANT ALL PRIVILEGES ON DATABASE "${n}" TO "flexinale";
|
||||
'';
|
||||
in
|
||||
''
|
||||
CREATE USER flexinale WITH SUPERUSER PASSWORD 'flexinale';
|
||||
''
|
||||
+ (lib.strings.concatMapStringsSep "\n" createDB [
|
||||
"monolith"
|
||||
"modulith-1"
|
||||
"modulith-2"
|
||||
"distributed-backoffice"
|
||||
"distributed-besucherportal"
|
||||
"distributed-ticketing"
|
||||
"distributed-test"
|
||||
]);
|
||||
};
|
||||
|
||||
# https://devenv.sh/scripts/
|
||||
scripts.monolith-load.exec = ''
|
||||
cd ${config.env.DEVENV_ROOT}/flex-training-flexinale
|
||||
mvn test -Dtest=testdata.TestDataLoader -pl flexinale-monolith -am
|
||||
'';
|
||||
|
||||
# https://devenv.sh/tests/
|
||||
enterTest = ''
|
||||
echo "Running tests"
|
||||
git --version | grep --color=auto "${pkgs.git.version}"
|
||||
'';
|
||||
|
||||
# https://devenv.sh/pre-commit-hooks/
|
||||
pre-commit.hooks.shellcheck.enable = true;
|
||||
|
||||
# See full reference at https://devenv.sh/reference/options/
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue