nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
fork

Configure Feed

Select the types of activity you want to include in your feed.

at netboot-syslinux-multiplatform 241 lines 5.9 kB view raw
1{ channel, pname, version, sha256Hash }: 2 3{ alsa-lib 4, bash 5, buildFHSEnv 6, cacert 7, coreutils 8, dbus 9, e2fsprogs 10, expat 11, fetchurl 12, findutils 13, file 14, fontsConf 15, git 16, glxinfo 17, gnugrep 18, gnused 19, gnutar 20, gtk2, gnome_vfs, glib, GConf 21, gzip 22, fontconfig 23, freetype 24, libpulseaudio 25, libGL 26, libuuid 27, libX11 28, libxcb 29, libXcomposite 30, libXcursor 31, libXdamage 32, libXext 33, libXfixes 34, libXi 35, libXrandr 36, libXrender 37, libXtst 38, makeWrapper 39, ncurses5 40, nspr 41, nss 42, pciutils 43, pkgsi686Linux 44, ps 45, setxkbmap 46, lib 47, stdenv 48, systemd 49, unzip 50, usbutils 51, which 52, runCommand 53, xkeyboard_config 54, zlib 55, makeDesktopItem 56, tiling_wm # if we are using a tiling wm, need to set _JAVA_AWT_WM_NONREPARENTING in wrapper 57}: 58 59let 60 drvName = "android-studio-${channel}-${version}"; 61 filename = "android-studio-${version}-linux.tar.gz"; 62 63 androidStudio = stdenv.mkDerivation { 64 name = "${drvName}-unwrapped"; 65 66 src = fetchurl { 67 url = "https://dl.google.com/dl/android/studio/ide-zips/${version}/${filename}"; 68 sha256 = sha256Hash; 69 }; 70 71 nativeBuildInputs = [ 72 unzip 73 makeWrapper 74 ]; 75 76 # Causes the shebangs in interpreter scripts deployed to mobile devices to be patched, which Android does not understand 77 dontPatchShebangs = true; 78 79 installPhase = '' 80 cp -r . $out 81 wrapProgram $out/bin/studio.sh \ 82 --set-default JAVA_HOME "$out/jbr" \ 83 --set ANDROID_EMULATOR_USE_SYSTEM_LIBS 1 \ 84 --set QT_XKB_CONFIG_ROOT "${xkeyboard_config}/share/X11/xkb" \ 85 ${lib.optionalString tiling_wm "--set _JAVA_AWT_WM_NONREPARENTING 1"} \ 86 --set FONTCONFIG_FILE ${fontsConf} \ 87 --prefix PATH : "${lib.makeBinPath [ 88 89 # Checked in studio.sh 90 coreutils 91 findutils 92 gnugrep 93 which 94 gnused 95 96 # For Android emulator 97 file 98 glxinfo 99 pciutils 100 setxkbmap 101 102 # Used during setup wizard 103 gnutar 104 gzip 105 106 # Runtime stuff 107 git 108 ps 109 usbutils 110 ]}" \ 111 --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ 112 113 # Crash at startup without these 114 fontconfig 115 freetype 116 libXext 117 libXi 118 libXrender 119 libXtst 120 121 # No crash, but attempted to load at startup 122 e2fsprogs 123 124 # Gradle wants libstdc++.so.6 125 stdenv.cc.cc.lib 126 # mksdcard wants 32 bit libstdc++.so.6 127 pkgsi686Linux.stdenv.cc.cc.lib 128 129 # aapt wants libz.so.1 130 zlib 131 pkgsi686Linux.zlib 132 # Support multiple monitors 133 libXrandr 134 135 # For Android emulator 136 alsa-lib 137 dbus 138 expat 139 libpulseaudio 140 libuuid 141 libX11 142 libxcb 143 libXcomposite 144 libXcursor 145 libXdamage 146 libXfixes 147 libGL 148 nspr 149 nss 150 systemd 151 152 # For GTKLookAndFeel 153 gtk2 154 gnome_vfs 155 glib 156 GConf 157 ]}" 158 159 # AS launches LLDBFrontend with a custom LD_LIBRARY_PATH 160 wrapProgram $(find $out -name LLDBFrontend) --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ 161 ncurses5 162 zlib 163 ]}" 164 ''; 165 }; 166 167 desktopItem = makeDesktopItem { 168 name = pname; 169 exec = pname; 170 icon = pname; 171 desktopName = "Android Studio (${channel} channel)"; 172 comment = "The official Android IDE"; 173 categories = [ "Development" "IDE" ]; 174 startupNotify = true; 175 startupWMClass = "jetbrains-studio"; 176 }; 177 178 # Android Studio downloads prebuilt binaries as part of the SDK. These tools 179 # (e.g. `mksdcard`) have `/lib/ld-linux.so.2` set as the interpreter. An FHS 180 # environment is used as a work around for that. 181 fhsEnv = buildFHSEnv { 182 name = "${drvName}-fhs-env"; 183 multiPkgs = pkgs: [ 184 ncurses5 185 186 # Flutter can only search for certs Fedora-way. 187 (runCommand "fedoracert" {} 188 '' 189 mkdir -p $out/etc/pki/tls/ 190 ln -s ${cacert}/etc/ssl/certs $out/etc/pki/tls/certs 191 '') 192 ]; 193 }; 194in runCommand 195 drvName 196 { 197 startScript = '' 198 #!${bash}/bin/bash 199 ${fhsEnv}/bin/${drvName}-fhs-env ${androidStudio}/bin/studio.sh "$@" 200 ''; 201 preferLocalBuild = true; 202 allowSubstitutes = false; 203 passthru = { 204 unwrapped = androidStudio; 205 }; 206 meta = with lib; { 207 description = "The Official IDE for Android (${channel} channel)"; 208 longDescription = '' 209 Android Studio is the official IDE for Android app development, based on 210 IntelliJ IDEA. 211 ''; 212 homepage = if channel == "stable" 213 then "https://developer.android.com/studio/index.html" 214 else "https://developer.android.com/studio/preview/index.html"; 215 license = with licenses; [ asl20 unfree ]; # The code is under Apache-2.0, but: 216 # If one selects Help -> Licenses in Android Studio, the dialog shows the following: 217 # "Android Studio includes proprietary code subject to separate license, 218 # including JetBrains CLion(R) (www.jetbrains.com/clion) and IntelliJ(R) 219 # IDEA Community Edition (www.jetbrains.com/idea)." 220 # Also: For actual development the Android SDK is required and the Google 221 # binaries are also distributed as proprietary software (unlike the 222 # source-code itself). 223 platforms = [ "x86_64-linux" ]; 224 maintainers = with maintainers; rec { 225 stable = [ alapshin ]; 226 beta = [ alapshin ]; 227 canary = [ alapshin ]; 228 dev = canary; 229 }."${channel}"; 230 mainProgram = pname; 231 }; 232 } 233 '' 234 mkdir -p $out/{bin,share/pixmaps} 235 236 echo -n "$startScript" > $out/bin/${pname} 237 chmod +x $out/bin/${pname} 238 239 ln -s ${androidStudio}/bin/studio.png $out/share/pixmaps/${pname}.png 240 ln -s ${desktopItem}/share/applications $out/share/applications 241 ''