feat: Setup development environment
The environment includes java, maven, IntelliJ and a postgres server.
This commit is contained in:
parent
414504d225
commit
a2cf29be34
5 changed files with 249 additions and 0 deletions
105
devenv.nix
Normal file
105
devenv.nix
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./nix/kafka.nix
|
||||
];
|
||||
# https://devenv.sh/basics/
|
||||
# env.GREET = "devenv";
|
||||
|
||||
# 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"
|
||||
]);
|
||||
|
||||
# initialDatabases =
|
||||
# map
|
||||
# (n: rec {
|
||||
# name = n;
|
||||
# user = "flexinale";
|
||||
# pass = "flexinale";
|
||||
# schema = pkgs.writeText "${name}.sql" ''
|
||||
# CREATE DATABASE "${name}";
|
||||
# GRANT ALL PRIVILEGES ON DATABASE "${name}" TO "${user}";
|
||||
# '';
|
||||
# })
|
||||
# [
|
||||
# "monolith"
|
||||
# "modulith-1"
|
||||
# "modulith-2"
|
||||
# "distributed-backoffice"
|
||||
# "distributed-besucherportal"
|
||||
# "distributed-ticketing"
|
||||
# "distributed-test"
|
||||
# ];
|
||||
};
|
||||
|
||||
# https://devenv.sh/scripts/
|
||||
scripts.hello.exec = ''
|
||||
echo hello from $GREET
|
||||
'';
|
||||
|
||||
# enterShell = ''
|
||||
# hello
|
||||
# git --version
|
||||
# '';
|
||||
|
||||
# https://devenv.sh/tasks/
|
||||
# tasks = {
|
||||
# "myproj:setup".exec = "mytool build";
|
||||
# "devenv:enterShell".after = [ "myproj:setup" ];
|
||||
# };
|
||||
|
||||
# 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