chore: fix nix build

This commit is contained in:
Julien Malka 2024-09-18 13:05:28 +00:00
parent 2ba34808ff
commit 69334a9ec6
7 changed files with 801 additions and 381 deletions

View file

@ -11,7 +11,7 @@ buildscript {
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.android.tools.build:gradle:7.4.2'
}
}

View file

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip

View file

@ -4,11 +4,12 @@
, gradle
, mavenRepo
, androidSdk
, aapt2
}:
stdenv.mkDerivation {
pname = "built-with-gradle";
version = "0.0";
version = "1.0";
src = ../android;
@ -20,11 +21,11 @@ stdenv.mkDerivation {
buildPhase = ''
runHook preBuild
gradle build \
gradle build -x :app:lintAnalyzeDebug -x :app:lintReportDebug -x :app:lintDebug -x:app:lintVitalAnalyzeRelease \
--offline --no-daemon --no-build-cache --info --full-stacktrace \
--warning-mode=all --parallel \
-PnixMavenRepo=${mavenRepo} \
-Dorg.gradle.project.android.aapt2FromMavenOverride=$ANDROID_SDK_ROOT/build-tools/30.0.3/aapt2
-Dorg.gradle.project.android.aapt2FromMavenOverride=${aapt2}/bin/aapt2
runHook postBuild
'';

View file

@ -1,5 +1,14 @@
{ sources ? import ../npins, pkgs ? import sources.nixpkgs {}, lib ? pkgs.lib, android ? import sources.android {} }:
let
apt2-version = "7.4.2-8841542";
aapt2 = (pkgs.callPackage "${sources.android}/pkgs/aapt2" { }).overrideAttrs (final: old: {
name = "aapt2-${apt2-version}";
src = pkgs.fetchurl {
url = "https://maven.google.com/com/android/tools/build/aapt2/${apt2-version}/aapt2-${apt2-version}-linux.jar";
sha256 = "sha256-bHKE8i7QbE0UFgn1TW4gzPj7MBV7t/PVo+Txd6jW0wE=";
};
});
androidSdk = android.sdk (sdkPkgs: with sdkPkgs; [
cmdline-tools-latest
build-tools-30-0-3
@ -9,7 +18,7 @@ let
]);
in lib.makeScope pkgs.newScope (self: with self; {
inherit androidSdk;
inherit androidSdk aapt2;
gradle = pkgs.gradle_7;

File diff suppressed because it is too large Load diff

View file

@ -74,7 +74,7 @@ let
sha256 = hash;
};
in
if version == 4 then
if version == 3 then
builtins.mapAttrs (_: mkSource) data.pins
else
throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"

View file

@ -8,16 +8,16 @@
"repo": "android-nixpkgs"
},
"branch": "main",
"revision": "5a052c62cdb51b210bc0717177d5bd014cba3df1",
"url": "https://github.com/tadfisher/android-nixpkgs/archive/5a052c62cdb51b210bc0717177d5bd014cba3df1.tar.gz",
"hash": "0w4psgbg4ld937zsycd90d5072bliqq1d3g140s9ln609g3ij3cx"
"revision": "6cc08eaad99b1f7c677f002110b3a0a1116cc5d7",
"url": "https://github.com/tadfisher/android-nixpkgs/archive/6cc08eaad99b1f7c677f002110b3a0a1116cc5d7.tar.gz",
"hash": "0iq892f2zcpl14p76ahimbwbxgk2a46jlchlkipvx78kakhdpqm4"
},
"nixpkgs": {
"type": "Channel",
"name": "nixpkgs-unstable",
"url": "https://releases.nixos.org/nixpkgs/nixpkgs-24.11pre674705.b833ff01a0d6/nixexprs.tar.xz",
"hash": "12cda9rvpgjcsxykbcg5cxjaayhibjjabv6svacjc5n5kpcbx5sf"
"url": "https://releases.nixos.org/nixpkgs/nixpkgs-24.11pre682572.658e7223191d/nixexprs.tar.xz",
"hash": "05pxq7nhv78rb1gy7v73g962n4h6c81cybhzkg0j0h8hiki2s46c"
}
},
"version": 4
"version": 3
}