about summary refs log tree commit diff
path: root/pkgs/applications/editors/jetbrains/darwin.nix
blob: f771894f533d70d05269a70ab926fe28a20b5144 (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
{ lib
, stdenvNoCC
, undmg
, ...
}:

{ meta
, pname
, product
, productShort ? product
, src
, version
, ...
}:

let
  loname = lib.toLower productShort;
in
  stdenvNoCC.mkDerivation {
    inherit pname meta src version;
    desktopName = product;
    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 = ".";
  }