sqlite_orm: 1.9 -> 1.9.1 (#379250)
[NixPkgs.git] / pkgs / by-name / an / android-studio-tools / package.nix
blob699f7405eb34ecd35a15853f7381255fe16ace79
2   lib,
3   stdenvNoCC,
4   fetchzip,
5   makeWrapper,
6   openjdk,
7 }:
9 stdenvNoCC.mkDerivation {
10   pname = "android-studio-tools";
11   version = "11076708";
13   src = fetchzip {
14     # The only difference between the Linux and Mac versions is a single comment at the top of all the scripts
15     # Therefore, we will use the Linux version and just patch the comment
16     url = "https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip";
17     hash = "sha256-NjxJzHRT2/zZ9YzzjqaMVxpOELkDneQgc1/y1GUnZow=";
18   };
20   postPatch =
21     ''
22       find . -type f -not -path "./bin/*" -exec chmod -x {} \;
23     ''
24     + lib.optionalString stdenvNoCC.hostPlatform.isDarwin ''
25       for f in cmdline-tools/bin/*; do
26         sed -i 's|start up script for Linux|start up script for Mac|' $f
27       done
28     '';
30   nativeBuildInputs = [ makeWrapper ];
32   dontConfigure = true;
33   dontBuild = true;
35   installPhase = ''
36     runHook preInstall
38     mkdir -p $out
39     cp -r . $out
41     for f in $out/bin/*; do
42       wrapProgram $f --set JAVA_HOME "${openjdk}"
43     done
45     runHook postInstall
46   '';
48   meta = {
49     description = "Android Studio CLI Tools";
50     homepage = "https://developer.android.com/studio";
51     downloadPage = "https://developer.android.com/studio";
52     changelog = "https://developer.android.com/studio/releases";
53     license = lib.licenses.unfree;
54     maintainers = with lib.maintainers; [ pandapip1 ];
55     platforms = lib.platforms.all;
56     sourceProvenance = with lib.sourceTypes; [ fromSource ]; # The 'binaries' are actually shell scripts
57   };