Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android-studio: Add desktop item #45853

Merged
merged 1 commit into from
Sep 2, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
60 changes: 42 additions & 18 deletions pkgs/applications/editors/android-studio/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change that to desktopName = "Android Studio (${channel} channel)";?
I think that would be pretty useful when a user installs releases from multiple channels.

comment = "The official Android IDE";
categories = "Development;IDE;";
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting startupNotify = true; and extraEntries="StartupWMClass=jetbrains-studio"; might be helpful as well.


};

# Android Studio downloads prebuilt binaries as part of the SDK. These tools
Expand All @@ -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}";
Expand All @@ -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 ];
};
}