summary refs log tree commit diff
path: root/pkgs/applications/editors/jetbrains/darwin.nix
blob: bd14cf2ffdad51f890913759a9c1e908533c69ac (plain) (blame)
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
33
34
35
36
37
38
39
40
{ lib
, stdenvNoCC
, undmg
, ...
}:

{ meta
, pname
, product
, productShort ? product
, src
, version
, plugins ? [ ]
, buildNumber
, ...
}:

let
  loname = lib.toLower productShort;
in
stdenvNoCC.mkDerivation {
  inherit pname meta src version plugins;
  passthru.buildNumber = buildNumber;
  desktopName = product;
  dontFixup = true;
  installPhase = ''
    runHook preInstall
    APP_DIR="$out/Applications/${product}.app"
    mkdir -p "$APP_DIR"
    cp -Tr "${product}.app" "$APP_DIR"
    mkdir -p "$out/bin"
    cat << EOF > "$out/bin/${loname}"
    open -na '$APP_DIR' --args "\$@"
    EOF
    chmod +x "$out/bin/${loname}"
    runHook postInstall
  '';
  nativeBuildInputs = [ undmg ];
  sourceRoot = ".";
}