Add java support

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2025-01-06 17:50:55 +02:00
parent 31f3364f06
commit 52f962e3b5
8 changed files with 55 additions and 20 deletions

View File

@@ -7,16 +7,13 @@ pkgs.mkShell {
];
shellHook = ''
export P10K_EXTRA_RIGHT_PROMPT_ELEMENTS=(
goenv
"''${P10K_EXTRA_RIGHT_PROMPT_ELEMENTS[@]}"
)
if git rev-parse --is-inside-work-tree &> /dev/null && ! grep -q "^\.go$" .gitignore .git/info/exclude; then
echo ".go" >> .git/info/exclude
export GOPATH="$(git rev-parse --show-toplevel)/.go"
if git rev-parse --is-inside-work-tree &> /dev/null; then
TOP="$(git rev-parse --show-toplevel)"
if ! grep -q "^\.go$" "$TOP/.gitignore" "$TOP/.git/info/exclude"; then echo ".go" >> "$TOP/.git/info/exclude"; fi
else
export GOPATH="$(pwd)/.go"
TOP="$(pwd)"
fi
export GOPATH="$TOP/.go"
'';
}

View File

@@ -0,0 +1,10 @@
{ pkgs, ... }:
pkgs.mkShell {
packages = with pkgs; [
jdk17
];
shellHook = ''
export JAVA_HOME=${pkgs.jdk17.home}
'';
}

View File

@@ -3,11 +3,4 @@ pkgs.mkShell {
packages = with pkgs; [
nodejs
];
shellHook = ''
export P10K_EXTRA_RIGHT_PROMPT_ELEMENTS=(
node_version
"''${P10K_EXTRA_RIGHT_PROMPT_ELEMENTS[@]}"
)
'';
}

View File

@@ -13,9 +13,24 @@ pkgs.mkShell {
];
shellHook = ''
export P10K_EXTRA_RIGHT_PROMPT_ELEMENTS=(
virtualenv
"''${P10K_EXTRA_RIGHT_PROMPT_ELEMENTS[@]}"
)
if git rev-parse --is-inside-work-tree &> /dev/null; then
TOP="$(git rev-parse --show-toplevel)"
if ! grep -q "^\.venv$" "$TOP/.gitignore" "$TOP/.git/info/exclude"; then echo ".venv" >> "$TOP/.git/info/exclude"; fi
else
TOP="$(pwd)"
fi
if [ -d "$TOP/.venv" ]; then
source "$TOP/.venv/bin/activate"
else
echo "No virtual environment found. Do you want to create one? (y/N)"
read -r answer
if [[ "$answer" =~ ^[Yy]$ ]]; then
python -m venv "$TOP/.venv"
source "$TOP/.venv/bin/activate"
pip install --upgrade pip
if [ -f "$TOP/requirements.txt" ]; then pip install -r "$TOP/requirements.txt"; fi
fi
fi
'';
}