From e71cbbad52db6874e0539725a3ca5cb37da3f647 Mon Sep 17 00:00:00 2001 From: Spotlight Date: Tue, 23 Apr 2024 09:40:07 -0500 Subject: [PATCH] darwin: Symlink default JDK --- darwin/darwin.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/darwin/darwin.nix b/darwin/darwin.nix index 630bd4b..60e3e0c 100644 --- a/darwin/darwin.nix +++ b/darwin/darwin.nix @@ -7,6 +7,18 @@ variables.EDITOR = "${pkgs.vim}/bin/vim"; }; + system.activationScripts.extraActivation.text = '' + # Remove the symlink if it doesn't already exist. + rm -f /Library/Java/JavaVirtualMachines/zulu-latest.jdk + + # We should only have a single JDK present within our package, + # but let's limit `find` regardless. + JDK_LOCATION="$(find "${pkgs.jdk}" -name "*.jdk" | head -n1)" + + # Symlink! + ln -sf "$JDK_LOCATION" "/Library/Java/JavaVirtualMachines/zulu-latest.jdk" + ''; + # Auto upgrade nix package and the daemon service. services.nix-daemon.enable = true; nix = {