1 { channel, pname, version, sha256Hash }:
42 , tiling_wm ? false # if we are using a tiling wm, need to set _JAVA_AWT_WM_NONREPARENTING in wrapper
46 drvName = "${pname}-${version}";
47 filename = "asfp-${version}-linux.deb";
49 androidStudioForPlatform = stdenv.mkDerivation {
50 name = "${drvName}-unwrapped";
53 url = "https://dl.google.com/android/asfp/${filename}";
63 cp -r "./opt/${pname}/" $out
64 wrapProgram $out/bin/studio.sh \
65 --set-default JAVA_HOME "$out/jbr" \
66 --set QT_XKB_CONFIG_ROOT "${xkeyboard_config}/share/X11/xkb" \
67 ${lib.optionalString tiling_wm "--set _JAVA_AWT_WM_NONREPARENTING 1"} \
68 --set FONTCONFIG_FILE ${fontsConf} \
69 --prefix PATH : "${lib.makeBinPath [
71 # Checked in studio.sh
78 # Used during setup wizard
95 --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [
96 # Crash at startup without these
105 # Support multiple monitors
118 desktopItem = makeDesktopItem {
122 desktopName = "Android Studio for Platform (${channel} channel)";
123 comment = "The official Android IDE for Android platform development";
124 categories = [ "Development" "IDE" ];
125 startupNotify = true;
126 startupWMClass = "jetbrains-studio";
129 # Android Studio for Platform downloads prebuilt binaries as part of the SDK. These tools
130 # (e.g. `mksdcard`) have `/lib/ld-linux.so.2` set as the interpreter. An FHS
131 # environment is used as a work around for that.
132 fhsEnv = buildFHSEnv {
133 name = "${drvName}-fhs-env";
140 export ALLOW_NINJA_ENV=true
141 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib:/usr/lib32
149 ${fhsEnv}/bin/${drvName}-fhs-env ${androidStudioForPlatform}/bin/studio.sh "$@"
151 preferLocalBuild = true;
152 allowSubstitutes = false;
154 unwrapped = androidStudioForPlatform;
157 description = "The Official IDE for Android platform development";
159 Android Studio for Platform (ASfP) is the version of the Android Studio IDE
160 for Android Open Source Project (AOSP) platform developers who build with the Soong build system.
162 homepage = "https://developer.android.com/studio/platform.html";
163 license = with licenses; [ asl20 unfree ]; # The code is under Apache-2.0, but:
164 # If one selects Help -> Licenses in Android Studio, the dialog shows the following:
165 # "Android Studio includes proprietary code subject to separate license,
166 # including JetBrains CLion(R) (www.jetbrains.com/clion) and IntelliJ(R)
167 # IDEA Community Edition (www.jetbrains.com/idea)."
168 # Also: For actual development the Android SDK is required and the Google
169 # binaries are also distributed as proprietary software (unlike the
170 # source-code itself).
171 platforms = [ "x86_64-linux" ];
172 maintainers = with maintainers; [ robbins ];
177 mkdir -p $out/{bin,share/pixmaps}
179 echo -n "$startScript" > $out/bin/${pname}
180 chmod +x $out/bin/${pname}
182 ln -s ${androidStudioForPlatform}/bin/studio.png $out/share/pixmaps/${pname}.png
183 ln -s ${desktopItem}/share/applications $out/share/applications