{ pkgs, ... }: { homebrew = { enable = true; brews = [ "openjdk" ]; }; system.activationScripts.postActivation.text = '' # Link the homebrew openjdk so that macos can use it ${if pkgs.system == "aarch64-darwin" then '' HOMEBREW_JAVAVM="/opt/homebrew/opt/openjdk/libexec/openjdk.jdk" '' else '' HOMEBREW_JAVAVM="/usr/local/opt/openjdk/libexec/openjdk.jdk" ''} MACOS_JAVAVM="/Library/Java/JavaVirtualMachines/openjdk.jdk" if [ -d "$HOMEBREW_JAVAVM" ]; then if [ ! -e "MACOS_JAVAVM" ]; then ln -sfn $HOMEBREW_JAVAVM $MACOS_JAVAVM; fi else if [ ! -e "$MACOS_JAVAVM" ]; then rm $MACOS_JAVAVM; fi fi ''; }