nixpkgs/pkgs/by-name/aa/aapt/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

50 lines
1.5 KiB
Nix

{ lib
, stdenvNoCC
, fetchzip
, autoPatchelfHook
, libcxx
}:
stdenvNoCC.mkDerivation rec {
pname = "aapt";
version = "8.4.1-11315950";
src =
let
urlAndHash =
if stdenvNoCC.hostPlatform.isLinux then {
url = "https://dl.google.com/android/maven2/com/android/tools/build/aapt2/${version}/aapt2-${version}-linux.jar";
hash = "sha256-eSQaZrRtb5aCG320hrXAL256fxa/oMhBC4hcTA1KRxs=";
} else if stdenvNoCC.hostPlatform.isDarwin then {
url = "https://dl.google.com/android/maven2/com/android/tools/build/aapt2/${version}/aapt2-${version}-osx.jar";
hash = "sha256-LUihNjase79JbUkHDb10A5d6pJ+VXDVfv7m09hkL8kY=";
} else throw "Unsupport platform: ${stdenvNoCC.system}";
in
fetchzip (urlAndHash // {
extension = "zip";
stripRoot = false;
});
nativeBuildInputs = lib.optionals stdenvNoCC.hostPlatform.isLinux [ autoPatchelfHook ];
buildInputs = lib.optionals stdenvNoCC.hostPlatform.isLinux [ libcxx ];
installPhase = ''
runHook preInstall
install -D aapt2 $out/bin/aapt2
runHook postInstall
'';
meta = {
description = "Build tool that compiles and packages Android app's resources";
mainProgram = "aapt2";
homepage = "https://developer.android.com/tools/aapt2";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ linsui ];
platforms = lib.platforms.unix;
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
};
}