Merge pull request #45853 from bkchr/android_studio_desktop

android-studio: Add desktop item
This commit is contained in:
Michael Weiss 2018-09-02 16:27:46 +02:00 committed by GitHub
commit 044c16a978
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -34,11 +34,12 @@
, writeTextFile , writeTextFile
, xkeyboard_config , xkeyboard_config
, zlib , zlib
, makeDesktopItem
}: }:
let let
drvName = "android-studio-${channel}-${version}"; drvName = "android-studio-${channel}-${version}";
androidStudio = stdenv.mkDerivation { androidStudio = stdenv.mkDerivation rec {
name = drvName; name = drvName;
src = fetchurl { src = fetchurl {
@ -110,7 +111,20 @@ let
]}" \ ]}" \
--set QT_XKB_CONFIG_ROOT "${xkeyboard_config}/share/X11/xkb" \ --set QT_XKB_CONFIG_ROOT "${xkeyboard_config}/share/X11/xkb" \
--set FONTCONFIG_FILE ${fontsConf} --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 # Android Studio downloads prebuilt binaries as part of the SDK. These tools
@ -121,8 +135,7 @@ let
multiPkgs = pkgs: [ pkgs.ncurses5 ]; multiPkgs = pkgs: [ pkgs.ncurses5 ];
}; };
in wrapper = writeTextFile {
writeTextFile {
name = "${drvName}-wrapper"; name = "${drvName}-wrapper";
# TODO: Rename preview -> beta (and add -stable suffix?): # TODO: Rename preview -> beta (and add -stable suffix?):
destination = "/bin/${pname}"; destination = "/bin/${pname}";
@ -131,7 +144,18 @@ in
#!${bash}/bin/bash #!${bash}/bin/bash
${fhsEnv}/bin/${drvName}-fhs-env ${androidStudio}/bin/studio.sh ${fhsEnv}/bin/${drvName}-fhs-env ${androidStudio}/bin/studio.sh
''; '';
} // { };
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; { meta = with stdenv.lib; {
description = "The Official IDE for Android (${channel} channel)"; description = "The Official IDE for Android (${channel} channel)";
longDescription = '' longDescription = ''
@ -145,4 +169,4 @@ in
platforms = [ "x86_64-linux" ]; platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ primeos ]; maintainers = with maintainers; [ primeos ];
}; };
} }