ctucx.git: nixfiles

ctucx' nixfiles

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
{ 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
  '';

}