tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
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
31
, stdenv
32
32
, unzip
33
33
, which
34
34
-
, writeTextFile
34
34
+
, runCommand
35
35
, xkeyboard_config
36
36
, zlib
37
37
, makeDesktopItem
···
39
39
40
40
let
41
41
drvName = "android-studio-${channel}-${version}";
42
42
-
androidStudio = stdenv.mkDerivation rec {
42
42
+
androidStudio = stdenv.mkDerivation {
43
43
name = drvName;
44
44
45
45
src = fetchurl {
···
111
111
]}" \
112
112
--set QT_XKB_CONFIG_ROOT "${xkeyboard_config}/share/X11/xkb" \
113
113
--set FONTCONFIG_FILE ${fontsConf}
114
114
-
115
115
-
install -Dm644 bin/studio.png $out/share/pixmaps/${drvName}.png
116
116
-
ln -s ${desktopItem}/share/applications $out/share/applications
117
114
'';
118
118
-
119
119
-
desktopItem = makeDesktopItem rec {
120
120
-
name = drvName;
121
121
-
exec = pname;
122
122
-
icon = drvName;
123
123
-
desktopName = "Android Studio";
124
124
-
comment = "The official Android IDE";
125
125
-
categories = "Development;IDE;";
126
126
-
};
115
115
+
};
127
116
117
117
+
desktopItem = makeDesktopItem {
118
118
+
name = drvName;
119
119
+
exec = pname;
120
120
+
icon = drvName;
121
121
+
desktopName = "Android Studio (${channel} channel)";
122
122
+
comment = "The official Android IDE";
123
123
+
categories = "Development;IDE;";
124
124
+
startupNotify = "true";
125
125
+
extraEntries="StartupWMClass=jetbrains-studio";
128
126
};
129
127
130
128
# Android Studio downloads prebuilt binaries as part of the SDK. These tools
···
134
132
name = "${drvName}-fhs-env";
135
133
multiPkgs = pkgs: [ pkgs.ncurses5 ];
136
134
};
137
137
-
138
138
-
wrapper = writeTextFile {
139
139
-
name = "${drvName}-wrapper";
140
140
-
# TODO: Rename preview -> beta (and add -stable suffix?):
141
141
-
destination = "/bin/${pname}";
142
142
-
executable = true;
143
143
-
text = ''
135
135
+
in runCommand
136
136
+
"${drvName}-wrapper"
137
137
+
{
138
138
+
startScript = ''
144
139
#!${bash}/bin/bash
145
140
${fhsEnv}/bin/${drvName}-fhs-env ${androidStudio}/bin/studio.sh
146
141
'';
147
147
-
};
148
148
-
in stdenv.mkDerivation {
149
149
-
name = "${drvName}-with-desktop-item";
150
150
-
151
151
-
buildCommand = ''
142
142
+
preferLocalBuild = true;
143
143
+
allowSubstitutes = false;
144
144
+
meta = with stdenv.lib; {
145
145
+
description = "The Official IDE for Android (${channel} channel)";
146
146
+
longDescription = ''
147
147
+
Android Studio is the official IDE for Android app development, based on
148
148
+
IntelliJ IDEA.
149
149
+
'';
150
150
+
homepage = if channel == "stable"
151
151
+
then https://developer.android.com/studio/index.html
152
152
+
else https://developer.android.com/studio/preview/index.html;
153
153
+
license = licenses.asl20;
154
154
+
platforms = [ "x86_64-linux" ];
155
155
+
maintainers = with maintainers; [ primeos ];
156
156
+
};
157
157
+
}
158
158
+
''
152
159
mkdir -p $out/{bin,share/pixmaps}
153
153
-
ln -s ${wrapper}/bin/${pname} $out/bin/${pname}
154
154
-
155
155
-
ln -s ${androidStudio}/share/pixmaps/${drvName}.png $out/share/pixmaps/${drvName}.png
156
156
-
ln -s ${androidStudio}/share/applications $out/share/applications
157
157
-
'';
158
160
159
159
-
meta = with stdenv.lib; {
160
160
-
description = "The Official IDE for Android (${channel} channel)";
161
161
-
longDescription = ''
162
162
-
Android Studio is the official IDE for Android app development, based on
163
163
-
IntelliJ IDEA.
164
164
-
'';
165
165
-
homepage = if channel == "stable"
166
166
-
then https://developer.android.com/studio/index.html
167
167
-
else https://developer.android.com/studio/preview/index.html;
168
168
-
license = licenses.asl20;
169
169
-
platforms = [ "x86_64-linux" ];
170
170
-
maintainers = with maintainers; [ primeos ];
171
171
-
};
172
172
-
}
161
161
+
# TODO: Rename preview -> beta (and add -stable suffix?):
162
162
+
echo -n "$startScript" > $out/bin/${pname}
163
163
+
chmod +x $out/bin/${pname}
164
164
+
ln -s ${androidStudio}/bin/studio.png $out/share/pixmaps/${drvName}.png
165
165
+
ln -s ${desktopItem}/share/applications $out/share/applications
166
166
+
''