summary refs log tree commit diff
path: root/pkgs/applications/editors/jetbrains/darwin.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/editors/jetbrains/darwin.nix')
-rw-r--r--pkgs/applications/editors/jetbrains/darwin.nix37
1 files changed, 37 insertions, 0 deletions
diff --git a/pkgs/applications/editors/jetbrains/darwin.nix b/pkgs/applications/editors/jetbrains/darwin.nix
new file mode 100644
index 00000000000..b1002e23582
--- /dev/null
+++ b/pkgs/applications/editors/jetbrains/darwin.nix
@@ -0,0 +1,37 @@
+{ lib
+, stdenvNoCC
+, undmg
+, ...
+}:
+
+{ meta
+, name
+, product
+, productShort ? product
+, src
+, version
+, ...
+}:
+
+let
+  loname = lib.toLower productShort;
+in
+  stdenvNoCC.mkDerivation {
+    inherit 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 ];
+    pname = lib.concatStringsSep "-" (lib.init (lib.splitString "-" name));
+    sourceRoot = ".";
+  }