summary refs log tree commit diff
path: root/pkgs/applications
diff options
context:
space:
mode:
authorBastian Köcher <git@kchr.de>2018-08-31 12:05:24 +0200
committerBastian Köcher <git@kchr.de>2018-08-31 12:05:24 +0200
commit6d28393eb146c6b51012312b9542f4e43cfbb128 (patch)
treec7bdbbf6822a77aa9cc3909334cc4ba23745bf02 /pkgs/applications
parenta823fb3ae5e1d6d8b45b1c82d454a7cdd7ceb7b6 (diff)
downloadnixlib-6d28393eb146c6b51012312b9542f4e43cfbb128.tar
nixlib-6d28393eb146c6b51012312b9542f4e43cfbb128.tar.gz
nixlib-6d28393eb146c6b51012312b9542f4e43cfbb128.tar.bz2
nixlib-6d28393eb146c6b51012312b9542f4e43cfbb128.tar.lz
nixlib-6d28393eb146c6b51012312b9542f4e43cfbb128.tar.xz
nixlib-6d28393eb146c6b51012312b9542f4e43cfbb128.tar.zst
nixlib-6d28393eb146c6b51012312b9542f4e43cfbb128.zip
android-studio: Add desktop item
Diffstat (limited to 'pkgs/applications')
-rw-r--r--pkgs/applications/editors/android-studio/common.nix60
1 files changed, 42 insertions, 18 deletions
diff --git a/pkgs/applications/editors/android-studio/common.nix b/pkgs/applications/editors/android-studio/common.nix
index cd031ce5ac8c..1d49c8c74a9a 100644
--- a/pkgs/applications/editors/android-studio/common.nix
+++ b/pkgs/applications/editors/android-studio/common.nix
@@ -34,11 +34,12 @@
 , writeTextFile
 , xkeyboard_config
 , zlib
+, makeDesktopItem
 }:
 
 let
   drvName = "android-studio-${channel}-${version}";
-  androidStudio = stdenv.mkDerivation {
+  androidStudio = stdenv.mkDerivation rec {
     name = drvName;
 
     src = fetchurl {
@@ -110,7 +111,20 @@ let
         ]}" \
         --set QT_XKB_CONFIG_ROOT "${xkeyboard_config}/share/X11/xkb" \
         --set FONTCONFIG_FILE ${fontsConf}
+
+        install -Dm644 bin/studio.png $out/share/pixmaps/${drvName}.png
+        ln -s ${desktopItem}/share/applications $out/share/applications
     '';
+
+    desktopItem = makeDesktopItem rec {
+      name = drvName;
+      exec = pname;
+      icon = drvName;
+      desktopName = "Android Studio";
+      comment = "The official Android IDE";
+      categories = "Development;IDE;";
+    };
+
   };
 
   # Android Studio downloads prebuilt binaries as part of the SDK. These tools
@@ -121,8 +135,7 @@ let
     multiPkgs = pkgs: [ pkgs.ncurses5 ];
   };
 
-in
-  writeTextFile {
+  wrapper = writeTextFile {
     name = "${drvName}-wrapper";
     # TODO: Rename preview -> beta (and add -stable suffix?):
     destination = "/bin/${pname}";
@@ -131,18 +144,29 @@ in
       #!${bash}/bin/bash
       ${fhsEnv}/bin/${drvName}-fhs-env ${androidStudio}/bin/studio.sh
     '';
-  } // {
-    meta = with stdenv.lib; {
-      description = "The Official IDE for Android (${channel} channel)";
-      longDescription = ''
-        Android Studio is the official IDE for Android app development, based on
-        IntelliJ IDEA.
-      '';
-      homepage = if channel == "stable"
-        then https://developer.android.com/studio/index.html
-        else https://developer.android.com/studio/preview/index.html;
-      license = licenses.asl20;
-      platforms = [ "x86_64-linux" ];
-      maintainers = with maintainers; [ primeos ];
-    };
-  }
+  };
+in stdenv.mkDerivation {
+  name = "${drvName}-with-desktop-item";
+
+  buildCommand = ''
+    mkdir -p $out/{bin,share/pixmaps}
+    ln -s ${wrapper}/bin/${pname} $out/bin/${pname}
+
+    ln -s ${androidStudio}/share/pixmaps/${drvName}.png $out/share/pixmaps/${drvName}.png
+    ln -s ${androidStudio}/share/applications $out/share/applications
+  '';
+
+  meta = with stdenv.lib; {
+    description = "The Official IDE for Android (${channel} channel)";
+    longDescription = ''
+      Android Studio is the official IDE for Android app development, based on
+      IntelliJ IDEA.
+    '';
+    homepage = if channel == "stable"
+      then https://developer.android.com/studio/index.html
+      else https://developer.android.com/studio/preview/index.html;
+    license = licenses.asl20;
+    platforms = [ "x86_64-linux" ];
+    maintainers = with maintainers; [ primeos ];
+  };
+}