tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
android-studio: Refactor the code & minor improvements
Michael Weiss
7 years ago
85e46d12
1ee3ad67
+39
-45
1 changed file
expand all
collapse all
unified
split
pkgs
applications
editors
android-studio
common.nix
+39
-45
pkgs/applications/editors/android-studio/common.nix
···
31
, stdenv
32
, unzip
33
, which
34
-
, writeTextFile
35
, xkeyboard_config
36
, zlib
37
, makeDesktopItem
···
39
40
let
41
drvName = "android-studio-${channel}-${version}";
42
-
androidStudio = stdenv.mkDerivation rec {
43
name = drvName;
44
45
src = fetchurl {
···
111
]}" \
112
--set QT_XKB_CONFIG_ROOT "${xkeyboard_config}/share/X11/xkb" \
113
--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
117
'';
118
-
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
0
0
0
0
0
0
0
0
0
128
};
129
130
# Android Studio downloads prebuilt binaries as part of the SDK. These tools
···
134
name = "${drvName}-fhs-env";
135
multiPkgs = pkgs: [ pkgs.ncurses5 ];
136
};
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 = ''
144
#!${bash}/bin/bash
145
${fhsEnv}/bin/${drvName}-fhs-env ${androidStudio}/bin/studio.sh
146
'';
147
-
};
148
-
in stdenv.mkDerivation {
149
-
name = "${drvName}-with-desktop-item";
150
-
151
-
buildCommand = ''
0
0
0
0
0
0
0
0
0
0
0
0
152
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
-
'';
158
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
-
}
···
31
, stdenv
32
, unzip
33
, which
34
+
, runCommand
35
, xkeyboard_config
36
, zlib
37
, makeDesktopItem
···
39
40
let
41
drvName = "android-studio-${channel}-${version}";
42
+
androidStudio = stdenv.mkDerivation {
43
name = drvName;
44
45
src = fetchurl {
···
111
]}" \
112
--set QT_XKB_CONFIG_ROOT "${xkeyboard_config}/share/X11/xkb" \
113
--set FONTCONFIG_FILE ${fontsConf}
0
0
0
114
'';
115
+
};
0
0
0
0
0
0
0
0
116
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";
126
};
127
128
# Android Studio downloads prebuilt binaries as part of the SDK. These tools
···
132
name = "${drvName}-fhs-env";
133
multiPkgs = pkgs: [ pkgs.ncurses5 ];
134
};
135
+
in runCommand
136
+
"${drvName}-wrapper"
137
+
{
138
+
startScript = ''
0
0
0
139
#!${bash}/bin/bash
140
${fhsEnv}/bin/${drvName}-fhs-env ${androidStudio}/bin/studio.sh
141
'';
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
+
''
159
mkdir -p $out/{bin,share/pixmaps}
0
0
0
0
0
160
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
+
''
0
0
0
0
0
0
0
0