git.iko.soy/typeable/nixpkgs
on master help sign in
android-studio: Refactor the code & minor improvements
commit85e46d12b33c848cb01a0d6563394ea07ac3d33f authorMichael Weiss <dev.primeos@gmail.com> dateSun 2 Sep 2018, 18:41 (8 years ago) parent1ee3ad6
1 file changed+39−45
pkgs/applications/editors/android-studio/common.nix+39−45
pkgs/applications/editors/android-studio/common.nix+39−45
@@ -31,7 +31,7 @@
3131, stdenv
3232, unzip
3333, which
34−, writeTextFile
34+, runCommand
3535, xkeyboard_config
3636, zlib
3737, makeDesktopItem
@@ -39,7 +39,7 @@
3939
4040let
4141 drvName = "android-studio-${channel}-${version}";
42− androidStudio = stdenv.mkDerivation rec {
42+ androidStudio = stdenv.mkDerivation {
4343 name = drvName;
4444
4545 src = fetchurl {
@@ -111,20 +111,18 @@ let
111111 ]}" \
112112 --set QT_XKB_CONFIG_ROOT "${xkeyboard_config}/share/X11/xkb" \
113113 --set FONTCONFIG_FILE ${fontsConf}
114−
115− install -Dm644 bin/studio.png $out/share/pixmaps/${drvName}.png
116− ln -s ${desktopItem}/share/applications $out/share/applications
117114 '';
115+ };
118116
119− desktopItem = makeDesktopItem rec {
120− name = drvName;
121− exec = pname;
122− icon = drvName;
123− desktopName = "Android Studio";
124− comment = "The official Android IDE";
125− categories = "Development;IDE;";
126− };
127−
117+ desktopItem = makeDesktopItem {
118+ name = drvName;
119+ exec = pname;
120+ icon = drvName;
121+ desktopName = "Android Studio (${channel} channel)";
122+ comment = "The official Android IDE";
123+ categories = "Development;IDE;";
124+ startupNotify = "true";
125+ extraEntries="StartupWMClass=jetbrains-studio";
128126 };
129127
130128 # Android Studio downloads prebuilt binaries as part of the SDK. These tools
@@ -134,39 +132,35 @@ let
134132 name = "${drvName}-fhs-env";
135133 multiPkgs = pkgs: [ pkgs.ncurses5 ];
136134 };
137−
138− wrapper = writeTextFile {
139− name = "${drvName}-wrapper";
140− # TODO: Rename preview -> beta (and add -stable suffix?):
141− destination = "/bin/${pname}";
142− executable = true;
143− text = ''
135+in runCommand
136+ "${drvName}-wrapper"
137+ {
138+ startScript = ''
144139 #!${bash}/bin/bash
145140 ${fhsEnv}/bin/${drvName}-fhs-env ${androidStudio}/bin/studio.sh
146141 '';
147− };
148−in stdenv.mkDerivation {
149− name = "${drvName}-with-desktop-item";
150−
151− buildCommand = ''
142+ preferLocalBuild = true;
143+ allowSubstitutes = false;
144+ meta = with stdenv.lib; {
145+ description = "The Official IDE for Android (${channel} channel)";
146+ longDescription = ''
147+ Android Studio is the official IDE for Android app development, based on
148+ IntelliJ IDEA.
149+ '';
150+ homepage = if channel == "stable"
151+ then https://developer.android.com/studio/index.html
152+ else https://developer.android.com/studio/preview/index.html;
153+ license = licenses.asl20;
154+ platforms = [ "x86_64-linux" ];
155+ maintainers = with maintainers; [ primeos ];
156+ };
157+ }
158+ ''
152159 mkdir -p $out/{bin,share/pixmaps}
153− ln -s ${wrapper}/bin/${pname} $out/bin/${pname}
154−
155− ln -s ${androidStudio}/share/pixmaps/${drvName}.png $out/share/pixmaps/${drvName}.png
156− ln -s ${androidStudio}/share/applications $out/share/applications
157− '';
158160
159− meta = with stdenv.lib; {
160− description = "The Official IDE for Android (${channel} channel)";
161− longDescription = ''
162− Android Studio is the official IDE for Android app development, based on
163− IntelliJ IDEA.
164− '';
165− homepage = if channel == "stable"
166− then https://developer.android.com/studio/index.html
167− else https://developer.android.com/studio/preview/index.html;
168− license = licenses.asl20;
169− platforms = [ "x86_64-linux" ];
170− maintainers = with maintainers; [ primeos ];
171− };
172−}
161+ # TODO: Rename preview -> beta (and add -stable suffix?):
162+ echo -n "$startScript" > $out/bin/${pname}
163+ chmod +x $out/bin/${pname}
164+ ln -s ${androidStudio}/bin/studio.png $out/share/pixmaps/${drvName}.png
165+ ln -s ${desktopItem}/share/applications $out/share/applications
166+ ''