about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/editors/jetbrains/bin/darwin.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/editors/jetbrains/bin/darwin.nix')
-rw-r--r--nixpkgs/pkgs/applications/editors/jetbrains/bin/darwin.nix40
1 files changed, 40 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/editors/jetbrains/bin/darwin.nix b/nixpkgs/pkgs/applications/editors/jetbrains/bin/darwin.nix
new file mode 100644
index 000000000000..747f03f55d5e
--- /dev/null
+++ b/nixpkgs/pkgs/applications/editors/jetbrains/bin/darwin.nix
@@ -0,0 +1,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 *.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 = ".";
+}