Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

Merge pull request #16752 from phunehehe/android-studio

android-studio: repackage in an FHS environment

authored by Robin Gloster and committed by GitHub cfdab94b bb4884bb

+95 -41
+82
pkgs/applications/editors/android-studio/default.nix
··· 1 + { bash 2 + , buildFHSUserEnv 3 + , coreutils 4 + , fetchurl 5 + , findutils 6 + , git 7 + , gnugrep 8 + , gnutar 9 + , gzip 10 + , jdk 11 + , libXrandr 12 + , makeWrapper 13 + , pkgsi686Linux 14 + , stdenv 15 + , unzip 16 + , which 17 + , writeTextFile 18 + , zlib 19 + }: 20 + 21 + let 22 + 23 + version = "2.1.2.0"; 24 + build = "143.2915827"; 25 + 26 + androidStudio = stdenv.mkDerivation { 27 + name = "android-studio"; 28 + buildInputs = [ 29 + makeWrapper 30 + unzip 31 + ]; 32 + installPhase = '' 33 + cp -r . $out 34 + wrapProgram $out/bin/studio.sh --set PATH "${stdenv.lib.makeBinPath [ 35 + 36 + # Checked in studio.sh 37 + coreutils 38 + findutils 39 + gnugrep 40 + jdk 41 + which 42 + 43 + # Used during setup wizard 44 + gnutar 45 + gzip 46 + 47 + # Runtime stuff 48 + git 49 + 50 + ]}" --set LD_LIBRARY_PATH "${stdenv.lib.makeLibraryPath [ 51 + # Gradle wants libstdc++.so.6 52 + stdenv.cc.cc.lib 53 + # mksdcard wants 32 bit libstdc++.so.6 54 + pkgsi686Linux.stdenv.cc.cc.lib 55 + # aapt wants libz.so.1 56 + zlib 57 + # Support multiple monitors 58 + libXrandr 59 + ]}" 60 + ''; 61 + src = fetchurl { 62 + url = "https://dl.google.com/dl/android/studio/ide-zips/${version}/android-studio-ide-${build}-linux.zip"; 63 + sha256 = "0q61m8yln77valg7y6lyxlml53z387zh6fyfgc22sm3br5ahbams"; 64 + }; 65 + }; 66 + 67 + # Android Studio downloads prebuilt binaries as part of the SDK. These tools 68 + # (e.g. `mksdcard`) have `/lib/ld-linux.so.2` set as the interpreter. An FHS 69 + # environment is used as a work around for that. 70 + fhsEnv = buildFHSUserEnv { 71 + name = "android-studio-fhs-env"; 72 + }; 73 + 74 + in writeTextFile { 75 + name = "android-studio-${version}"; 76 + destination = "/bin/android-studio"; 77 + executable = true; 78 + text = '' 79 + #!${bash}/bin/bash 80 + ${fhsEnv}/bin/android-studio-fhs-env ${androidStudio}/bin/studio.sh 81 + ''; 82 + }
-41
pkgs/applications/editors/idea/default.nix
··· 10 10 bnumber = with stdenv.lib; build: last (splitString "-" build); 11 11 mkIdeaProduct = callPackage ./common.nix { }; 12 12 13 - buildAndroidStudio = { name, version, build, src, license, description, wmClass }: 14 - let drv = (mkIdeaProduct rec { 15 - inherit name version build src wmClass jdk; 16 - product = "Studio"; 17 - meta = with stdenv.lib; { 18 - homepage = https://developer.android.com/sdk/installing/studio.html; 19 - inherit description license; 20 - longDescription = '' 21 - Android development environment based on IntelliJ 22 - IDEA providing new features and improvements over 23 - Eclipse ADT and will be the official Android IDE 24 - once it's ready. 25 - ''; 26 - platforms = platforms.linux; 27 - hydraPlatforms = []; # Depends on androidsdk, which hits Hydra's output limits 28 - maintainers = with maintainers; [ edwtjo ]; 29 - }; 30 - }); 31 - in stdenv.lib.overrideDerivation drv (x : { 32 - buildInputs = x.buildInputs ++ [ makeWrapper ]; 33 - installPhase = x.installPhase + '' 34 - wrapProgram "$out/bin/android-studio" \ 35 - --set ANDROID_HOME "${androidsdk}/libexec/" \ 36 - --set LD_LIBRARY_PATH "${stdenv.cc.cc.lib}/lib" # Gradle installs libnative-platform.so in ~/.gradle, that requires libstdc++.so.6 37 - ''; 38 - }); 39 - 40 13 buildClion = { name, version, build, src, license, description, wmClass }: 41 14 (mkIdeaProduct rec { 42 15 inherit name version build src wmClass jdk; ··· 147 120 in 148 121 149 122 { 150 - 151 - android-studio = let buildNumber = "143.2915827"; in buildAndroidStudio rec { 152 - name = "android-studio-${version}"; 153 - version = "2.1.2.0"; 154 - build = "AI-${buildNumber}"; 155 - description = "Android development environment based on IntelliJ IDEA"; 156 - license = stdenv.lib.licenses.asl20; 157 - src = fetchurl { 158 - url = "https://dl.google.com/dl/android/studio/ide-zips/${version}" + 159 - "/android-studio-ide-${buildNumber}-linux.zip"; 160 - sha256 = "0q61m8yln77valg7y6lyxlml53z387zh6fyfgc22sm3br5ahbams"; 161 - }; 162 - wmClass = "jetbrains-studio"; 163 - }; 164 123 165 124 clion = buildClion rec { 166 125 name = "clion-${version}";
+13
pkgs/top-level/all-packages.nix
··· 12274 12274 12275 12275 amsn = callPackage ../applications/networking/instant-messengers/amsn { }; 12276 12276 12277 + # Oracle JDK is recommended upstream, but unfree and requires a manual 12278 + # download. OpenJDK is straightforward, but may suffer from compatibility 12279 + # problems e.g. https://code.google.com/p/android/issues/detail?id=174496. 12280 + # To use Oracle JDK add an override to ~/.nixpkgs/config.nix: 12281 + # { 12282 + # packageOverrides = pkgs: { 12283 + # android-studio = pkgs.android-studio.override { 12284 + # jdk = pkgs.oraclejdk8; 12285 + # }; 12286 + # }; 12287 + # } 12288 + android-studio = callPackage ../applications/editors/android-studio { }; 12289 + 12277 12290 antimony = qt5.callPackage ../applications/graphics/antimony {}; 12278 12291 12279 12292 antiword = callPackage ../applications/office/antiword {};