diff options
author | Robin Gloster <mail@glob.in> | 2016-08-11 17:10:01 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-11 17:10:01 +0000 |
commit | cfdab94bb3d90edc3fd226a44eb1476c42d8d98a (patch) | |
tree | 491a892e29cf0e0ca144e6a5ec859b97bf66f481 /pkgs/applications | |
parent | bb4884bb3205e36d9ff67be33638728fd6c6fccc (diff) | |
parent | f822b93e0558441962ac7f18b2f39848ca75f154 (diff) |
Merge pull request #16752 from phunehehe/android-studio
android-studio: repackage in an FHS environment
Diffstat (limited to 'pkgs/applications')
-rw-r--r-- | pkgs/applications/editors/android-studio/default.nix | 82 | ||||
-rw-r--r-- | pkgs/applications/editors/idea/default.nix | 41 |
2 files changed, 82 insertions, 41 deletions
diff --git a/pkgs/applications/editors/android-studio/default.nix b/pkgs/applications/editors/android-studio/default.nix new file mode 100644 index 0000000000000..eea686d691ded --- /dev/null +++ b/pkgs/applications/editors/android-studio/default.nix @@ -0,0 +1,82 @@ +{ bash +, buildFHSUserEnv +, coreutils +, fetchurl +, findutils +, git +, gnugrep +, gnutar +, gzip +, jdk +, libXrandr +, makeWrapper +, pkgsi686Linux +, stdenv +, unzip +, which +, writeTextFile +, zlib +}: + +let + + version = "2.1.2.0"; + build = "143.2915827"; + + androidStudio = stdenv.mkDerivation { + name = "android-studio"; + buildInputs = [ + makeWrapper + unzip + ]; + installPhase = '' + cp -r . $out + wrapProgram $out/bin/studio.sh --set PATH "${stdenv.lib.makeBinPath [ + + # Checked in studio.sh + coreutils + findutils + gnugrep + jdk + which + + # Used during setup wizard + gnutar + gzip + + # Runtime stuff + git + + ]}" --set LD_LIBRARY_PATH "${stdenv.lib.makeLibraryPath [ + # Gradle wants libstdc++.so.6 + stdenv.cc.cc.lib + # mksdcard wants 32 bit libstdc++.so.6 + pkgsi686Linux.stdenv.cc.cc.lib + # aapt wants libz.so.1 + zlib + # Support multiple monitors + libXrandr + ]}" + ''; + src = fetchurl { + url = "https://dl.google.com/dl/android/studio/ide-zips/${version}/android-studio-ide-${build}-linux.zip"; + sha256 = "0q61m8yln77valg7y6lyxlml53z387zh6fyfgc22sm3br5ahbams"; + }; + }; + + # Android Studio downloads prebuilt binaries as part of the SDK. These tools + # (e.g. `mksdcard`) have `/lib/ld-linux.so.2` set as the interpreter. An FHS + # environment is used as a work around for that. + fhsEnv = buildFHSUserEnv { + name = "android-studio-fhs-env"; + }; + +in writeTextFile { + name = "android-studio-${version}"; + destination = "/bin/android-studio"; + executable = true; + text = '' + #!${bash}/bin/bash + ${fhsEnv}/bin/android-studio-fhs-env ${androidStudio}/bin/studio.sh + ''; +} diff --git a/pkgs/applications/editors/idea/default.nix b/pkgs/applications/editors/idea/default.nix index 7bfa55d28bdd2..c113b63390faf 100644 --- a/pkgs/applications/editors/idea/default.nix +++ b/pkgs/applications/editors/idea/default.nix @@ -10,33 +10,6 @@ let bnumber = with stdenv.lib; build: last (splitString "-" build); mkIdeaProduct = callPackage ./common.nix { }; - buildAndroidStudio = { name, version, build, src, license, description, wmClass }: - let drv = (mkIdeaProduct rec { - inherit name version build src wmClass jdk; - product = "Studio"; - meta = with stdenv.lib; { - homepage = https://developer.android.com/sdk/installing/studio.html; - inherit description license; - longDescription = '' - Android development environment based on IntelliJ - IDEA providing new features and improvements over - Eclipse ADT and will be the official Android IDE - once it's ready. - ''; - platforms = platforms.linux; - hydraPlatforms = []; # Depends on androidsdk, which hits Hydra's output limits - maintainers = with maintainers; [ edwtjo ]; - }; - }); - in stdenv.lib.overrideDerivation drv (x : { - buildInputs = x.buildInputs ++ [ makeWrapper ]; - installPhase = x.installPhase + '' - wrapProgram "$out/bin/android-studio" \ - --set ANDROID_HOME "${androidsdk}/libexec/" \ - --set LD_LIBRARY_PATH "${stdenv.cc.cc.lib}/lib" # Gradle installs libnative-platform.so in ~/.gradle, that requires libstdc++.so.6 - ''; - }); - buildClion = { name, version, build, src, license, description, wmClass }: (mkIdeaProduct rec { inherit name version build src wmClass jdk; @@ -148,20 +121,6 @@ in { - android-studio = let buildNumber = "143.2915827"; in buildAndroidStudio rec { - name = "android-studio-${version}"; - version = "2.1.2.0"; - build = "AI-${buildNumber}"; - description = "Android development environment based on IntelliJ IDEA"; - license = stdenv.lib.licenses.asl20; - src = fetchurl { - url = "https://dl.google.com/dl/android/studio/ide-zips/${version}" + - "/android-studio-ide-${buildNumber}-linux.zip"; - sha256 = "0q61m8yln77valg7y6lyxlml53z387zh6fyfgc22sm3br5ahbams"; - }; - wmClass = "jetbrains-studio"; - }; - clion = buildClion rec { name = "clion-${version}"; version = "1.2.5"; |