1+ #!/usr/bin/env nu
2+ -----------------------------------------------------------------------------
3+ # Script : sdkman-patch.nu
4+ # Desc : Install SDKMAN and apply patches to fix Nushell compatibility
5+ # Date : 10-27-2025
6+ #
7+ # Usage:
8+ # ./sdkman-patch.nu
9+ # - Installs SDKMAN via bash (if not present)
10+ # - Installs specified SDK tools via bash
11+ # - Applies patches to ~/.local/sdkman for Nushell compatibility
12+ #
13+ # Notes:
14+ # - Run from directory containing configs/sdkman/ with patch files
15+ # - Requires bash, patch, wget/curl utilities
16+ # - SDK commands must run in bash shell, not nushell
17+ #
18+ # tag: linux-only
19+ # -----------------------------------------------------------------------------
20+
21+ # Install SDKMAN if not present (requires bash)
22+ if not (' ~/.local/sdkman' | path exists ) {
23+ print " Installing SDKMAN..."
24+ # wet2 --quiet --output-document - https://get.sdkman.io | bash
25+ # update .bashrc
26+ }
27+
28+ # Install SDK tools (must run in bash environment)
29+ print " Installing SDK tools..."
30+ # env.Path is managed by init.sh
31+ # source ~/.local/sdkman/bin/sdkman-init.sh
32+ sdk install gradle 9.1.0
33+ sdk install java 24.0.2-tem
34+ sdk install kotlin 2.2.21 # doesn't target JVM 25 yet
35+
36+ # Apply patches for Nushell compatibility
37+ # glob on configs/sdkman should also work
38+ for patch_file in [configs/sdkman/sdkman-init.patch configs/sdkman/sdkman-path-helpers.patch ] {
39+ print $" Applying ($patch_file )..."
40+ # not sure if this would work
41+ # patch -d ~/.local/sdkman -p0
42+ open $patch_file | patch - d / - p0
43+ }
44+
45+ print " Done! Restart your shell or source the config."
0 commit comments