Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/licenses.nix
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,11 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
# channel and NixOS images.
};

unicode-dfs-2015 = spdx {
Comment thread
primeos marked this conversation as resolved.
Outdated
spdxId = "Unicode-DFS-2015";
fullName = "Unicode License Agreement - Data Files and Software (2015)";
};

unicode-dfs-2016 = spdx {
spdxId = "Unicode-DFS-2016";
fullName = "Unicode License Agreement - Data Files and Software (2016)";
Expand Down
46 changes: 46 additions & 0 deletions pkgs/tools/misc/android-tools/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{ lib, stdenv, fetchurl
, cmake, perl, go
, protobuf, zlib, gtest, brotli, lz4, zstd, libusb1, pcre2
}:

stdenv.mkDerivation rec {
pname = "android-tools";
version = "31.0.0p1";

src = fetchurl {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be using fetchFromGitHub?

@musfay musfay May 31, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to use release tarball as the repo only have build-system and documentation. Upstream doesn't vendorize platform-tools source code in repo. They use CPack to create tarball from used source files.
https://github.com/nmeum/android-tools/tree/master/vendor

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How many sources would we need to declare in Nix to achieve the same? I'd prefer if all sources were declared transparently instead of relying on an opaque tarball.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well in that case we need to checkout some of AOSP repositories. Those repositories are actually HUGE and Google doesn't provide snapshots from tags. Checking out repositories takes nearly 1 hour on my computer.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole tree is obviously huge but we shouldn't need all of it. That's why I was asking.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can declare the source files but there is 13-14 repos and lots of files all aroud the tree. Leaving the tracking job to CPack would be much easier. I don't agree tarballs are opaque as you can reproduce them. We can create our tarballs or vendorize CPack output in a repository.

@musfay musfay May 31, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it legally OK if we mirror some of Google's repositories on other platforms like this one?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is 13-14 repos

Yeah, that's a bit much.

I don't agree tarballs are opaque as you can reproduce them.

The problem with that is that the reproduction is not transparent and in this case probably not even reproducible at a different point in time.
You don't know anything about how CPack was made nor which version of the sources it fetched.
Google's repo doesn't have a single "revision" or an equivalent; it's an aggregation of whatever happens to be at the top of a few hundred repos at a certain point in time.
It'd only become transparent if the generation was declared in Nix because then you'd have to lock the exact revision and hash of every included repo.

As I said though, too many repos. I was hoping for, like, 5 which would've been a feasible amount to maintain ourselves.

Is it legally OK if we mirror some of Google's repositories

The APL2 allows you to redistribute source code in any way you like but, why?

@musfay musfay Jun 1, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't agree tarballs are opaque as you can reproduce them.

The problem with that is that the reproduction is not transparent and in this case probably not even reproducible at a different point in time.
You don't know anything about how CPack was made nor which version of the sources it fetched.
Google's repo doesn't have a single "revision" or an equivalent; it's an aggregation of whatever happens to be at the top of a few hundred repos at a certain point in time.
It'd only become transparent if the generation was declared in Nix because then you'd have to lock the exact revision and hash of every included repo.

It makes sense now. Thanks for the definition!

As I said though, too many repos. I was hoping for, like, 5 which would've been a feasible amount to maintain ourselves.

Yep there is lots of repos.

Is it legally OK if we mirror some of Google's repositories

The APL2 allows you to redistribute source code in any way you like but, why?

Just asked, offtopic.

url = "https://github.com/nmeum/android-tools/releases/download/${version}/android-tools-${version}.tar.xz";
sha256 = "1dn7v10gdx1pi0pkddznd5sdz941qz0x4jww8h2mk50nbyxc792i";
};

nativeBuildInputs = [ cmake perl go ];
buildInputs = [ protobuf zlib gtest brotli lz4 zstd libusb1 pcre2 ];

# Don't try to fetch any Go modules via the network:
GOFLAGS = [ "-mod=vendor" ];

preConfigure = ''
export GOCACHE=$TMPDIR/go-cache
'';

meta = with lib; {
description = "Android SDK platform tools";
longDescription = ''
Android SDK Platform-Tools is a component for the Android SDK. It
includes tools that interface with the Android platform, such as adb and
fastboot. These tools are required for Android app development. They're
also needed if you want to unlock your device bootloader and flash it
with a new system image.
Currently the following tools are supported:
- adb
- fastboot
- mke2fs.android (required by fastboot)
- simg2img, img2simg, append2simg
'';
# https://developer.android.com/studio/command-line#tools-platform
# https://developer.android.com/studio/releases/platform-tools
homepage = "https://github.com/nmeum/android-tools";
license = with licenses; [ asl20 unicode-dfs-2015 ];
platforms = platforms.linux;
maintainers = with maintainers; [ primeos ];
};
}
4 changes: 4 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,10 @@ in

analog = callPackage ../tools/admin/analog {};

android-tools = lowPrio (callPackage ../tools/misc/android-tools {
stdenv = if stdenv.targetPlatform.isAarch64 then gcc10Stdenv else stdenv;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was likely required for #124992 (comment) ;)

});

angle-grinder = callPackage ../tools/text/angle-grinder {};

ansifilter = callPackage ../tools/text/ansifilter {};
Expand Down