androidenv: use callPackage instead of import & fix infinite recursion
infinite recursion was due to autoPatchelfHook being in buildInputs of platform-tools, i will add a lint for it in nix-community/nixpkgs-lint. ``` $ nix build ".#pkgsCross.aarch64-android-prebuilt.hello" --show-trace 2>&1 | rg 'while evaluating the attr.+deriv' … while evaluating the attribute 'stdenv' of the derivation 'zlib-aarch64-unknown-linux-android-1.2.13' … while evaluating the attribute 'CPPFLAGS' of the derivation 'python3-aarch64-unknown-linux-android-3.10.8' … while evaluating the attribute 'setuptools' of the derivation 'python-catch-conflicts-hook' … while evaluating the attribute 'nativeBuildInputs' of the derivation 'python3.10-pyelftools-0.28' … while evaluating the attribute 'passAsFile' of the derivation 'python3-3.10.8-env' … while evaluating the attribute 'pythonInterpreter' of the derivation 'auto-patchelf-hook' … while evaluating the attribute 'buildInputs' of the derivation 'platform-tools-33.0.2' … while evaluating the attribute 'installPhase' of the derivation 'ndk-24.0.8215888' … while evaluating the attribute 'installPhase' of the derivation 'aarch64-unknown-linux-android-ndk-toolchain-24.0.8215888' … while evaluating the attribute 'bintools_bin' of the derivation 'aarch64-unknown-linux-android-ndk-toolchain-wrapper-24.0.8215888' … while evaluating the attribute 'bintools' of the derivation 'aarch64-unknown-linux-android-ndk-toolchain-wrapper-24.0.8215888' … while evaluating the attribute 'defaultNativeBuildInputs' of the derivation 'stdenv-linux' … while evaluating the attribute 'stdenv' of the derivation 'hello-aarch64-unknown-linux-android-2.12.1' ``` stdenv -> stdenv.cc -> bintools -> android-ndk-toolchain -> ndk -> platform-tools -> auto-patchelf-hook -> python3 -> zlib -> stdenv -> stdenv.cc -> ... autoPatchelfHook was in buildInputs of platform-tools so we needed the host tools to build it but platform-tools was a required tool
This commit is contained in:
parent
c2335ed06a
commit
a2f85e0fa8
|
@ -1,10 +1,10 @@
|
|||
{deployAndroidPackage, lib, package, os, autoPatchelfHook, makeWrapper, pkgs, pkgs_i686}:
|
||||
{deployAndroidPackage, lib, package, os, autoPatchelfHook, makeWrapper, pkgs, pkgsi686Linux}:
|
||||
|
||||
deployAndroidPackage {
|
||||
inherit package os;
|
||||
nativeBuildInputs = [ makeWrapper ]
|
||||
++ lib.optionals (os == "linux") [ autoPatchelfHook ];
|
||||
buildInputs = lib.optionals (os == "linux") [ pkgs.glibc pkgs.zlib pkgs.ncurses5 pkgs_i686.glibc pkgs_i686.zlib pkgs_i686.ncurses5 pkgs.libcxx ];
|
||||
buildInputs = lib.optionals (os == "linux") [ pkgs.glibc pkgs.zlib pkgs.ncurses5 pkgsi686Linux.glibc pkgsi686Linux.zlib pkgsi686Linux.ncurses5 pkgs.libcxx ];
|
||||
patchInstructions = ''
|
||||
${lib.optionalString (os == "linux") ''
|
||||
addAutoPatchelfSearchPath $packageBaseDir/lib
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ requireFile, autoPatchelfHook, pkgs, pkgsHostHost, pkgs_i686
|
||||
{ callPackage, stdenv, lib, fetchurl, ruby, writeText
|
||||
, licenseAccepted ? false
|
||||
}:
|
||||
|
||||
|
@ -25,9 +25,6 @@
|
|||
}:
|
||||
|
||||
let
|
||||
inherit (pkgs) stdenv lib fetchurl;
|
||||
inherit (pkgs.buildPackages) makeWrapper unzip;
|
||||
|
||||
# Determine the Android os identifier from Nix's system identifier
|
||||
os = if stdenv.system == "x86_64-linux" then "linux"
|
||||
else if stdenv.system == "x86_64-darwin" then "macosx"
|
||||
|
@ -35,7 +32,7 @@ let
|
|||
|
||||
# Uses mkrepo.rb to create a repo spec.
|
||||
mkRepoJson = { packages ? [], images ? [], addons ? [] }: let
|
||||
mkRepoRuby = (pkgs.ruby.withPackages (pkgs: with pkgs; [ slop nokogiri ]));
|
||||
mkRepoRuby = (ruby.withPackages (pkgs: with pkgs; [ slop nokogiri ]));
|
||||
mkRepoRubyArguments = lib.lists.flatten [
|
||||
(builtins.map (package: ["--packages" "${package}"]) packages)
|
||||
(builtins.map (image: ["--images" "${image}"]) images)
|
||||
|
@ -115,25 +112,24 @@ let
|
|||
] ++ extraLicenses);
|
||||
in
|
||||
rec {
|
||||
deployAndroidPackage = import ./deploy-androidpackage.nix {
|
||||
inherit stdenv unzip;
|
||||
deployAndroidPackage = callPackage ./deploy-androidpackage.nix {
|
||||
};
|
||||
|
||||
platform-tools = import ./platform-tools.nix {
|
||||
inherit deployAndroidPackage autoPatchelfHook pkgs lib;
|
||||
platform-tools = callPackage ./platform-tools.nix {
|
||||
inherit deployAndroidPackage;
|
||||
os = if stdenv.system == "aarch64-darwin" then "macosx" else os; # "macosx" is a universal binary here
|
||||
package = packages.platform-tools.${platformToolsVersion};
|
||||
};
|
||||
|
||||
build-tools = map (version:
|
||||
import ./build-tools.nix {
|
||||
inherit deployAndroidPackage os autoPatchelfHook makeWrapper pkgs pkgs_i686 lib;
|
||||
callPackage ./build-tools.nix {
|
||||
inherit deployAndroidPackage;
|
||||
package = packages.build-tools.${version};
|
||||
}
|
||||
) buildToolsVersions;
|
||||
|
||||
emulator = import ./emulator.nix {
|
||||
inherit deployAndroidPackage os autoPatchelfHook makeWrapper pkgs pkgs_i686 lib;
|
||||
emulator = callPackage ./emulator.nix {
|
||||
inherit deployAndroidPackage os;
|
||||
package = packages.emulator.${emulatorVersion};
|
||||
};
|
||||
|
||||
|
@ -171,16 +167,16 @@ rec {
|
|||
) platformVersions);
|
||||
|
||||
cmake = map (version:
|
||||
import ./cmake.nix {
|
||||
inherit deployAndroidPackage os autoPatchelfHook pkgs lib stdenv;
|
||||
callPackage ./cmake.nix {
|
||||
inherit deployAndroidPackage os;
|
||||
package = packages.cmake.${version};
|
||||
}
|
||||
) cmakeVersions;
|
||||
|
||||
# Creates a NDK bundle.
|
||||
makeNdkBundle = ndkVersion:
|
||||
import ./ndk-bundle {
|
||||
inherit deployAndroidPackage os autoPatchelfHook makeWrapper pkgs pkgsHostHost lib platform-tools stdenv;
|
||||
callPackage ./ndk-bundle {
|
||||
inherit deployAndroidPackage os platform-tools;
|
||||
package = packages.ndk-bundle.${ndkVersion} or packages.ndk.${ndkVersion};
|
||||
};
|
||||
|
||||
|
@ -253,8 +249,8 @@ rec {
|
|||
${lib.concatMapStringsSep "\n" (str: " - ${str}") licenseNames}
|
||||
|
||||
by setting nixpkgs config option 'android_sdk.accept_license = true;'.
|
||||
'' else import ./tools.nix {
|
||||
inherit deployAndroidPackage requireFile packages toolsVersion autoPatchelfHook makeWrapper os pkgs pkgs_i686 lib;
|
||||
'' else callPackage ./tools.nix {
|
||||
inherit deployAndroidPackage packages toolsVersion;
|
||||
|
||||
postInstall = ''
|
||||
# Symlink all requested plugins
|
||||
|
@ -323,7 +319,7 @@ rec {
|
|||
${lib.concatMapStrings (licenseName:
|
||||
let
|
||||
licenseHashes = builtins.concatStringsSep "\n" (mkLicenseHashes licenseName);
|
||||
licenseHashFile = pkgs.writeText "androidenv-${licenseName}" licenseHashes;
|
||||
licenseHashFile = writeText "androidenv-${licenseName}" licenseHashes;
|
||||
in
|
||||
''
|
||||
ln -s ${licenseHashFile} licenses/${licenseName}
|
||||
|
|
|
@ -1,21 +1,17 @@
|
|||
{ config, pkgs ? import <nixpkgs> {}, pkgsHostHost ? pkgs.pkgsHostHost
|
||||
, pkgs_i686 ? import <nixpkgs> { system = "i686-linux"; }
|
||||
{ config, pkgs ? import <nixpkgs> {}
|
||||
, licenseAccepted ? config.android_sdk.accept_license or false
|
||||
}:
|
||||
|
||||
rec {
|
||||
composeAndroidPackages = import ./compose-android-packages.nix {
|
||||
inherit (pkgs) requireFile autoPatchelfHook;
|
||||
inherit pkgs pkgsHostHost pkgs_i686 licenseAccepted;
|
||||
composeAndroidPackages = pkgs.callPackage ./compose-android-packages.nix {
|
||||
inherit licenseAccepted;
|
||||
};
|
||||
|
||||
buildApp = import ./build-app.nix {
|
||||
inherit (pkgs) stdenv lib jdk ant gnumake gawk;
|
||||
buildApp = pkgs.callPackage ./build-app.nix {
|
||||
inherit composeAndroidPackages;
|
||||
};
|
||||
|
||||
emulateApp = import ./emulate-app.nix {
|
||||
inherit (pkgs) stdenv lib runtimeShell;
|
||||
emulateApp = pkgs.callPackage ./emulate-app.nix {
|
||||
inherit composeAndroidPackages;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ deployAndroidPackage, lib, package, os, autoPatchelfHook, makeWrapper, pkgs, pkgs_i686 }:
|
||||
{ deployAndroidPackage, lib, package, os, autoPatchelfHook, makeWrapper, pkgs, pkgsi686Linux }:
|
||||
|
||||
deployAndroidPackage {
|
||||
inherit package os;
|
||||
|
@ -13,7 +13,7 @@ deployAndroidPackage {
|
|||
zlib
|
||||
ncurses5
|
||||
stdenv.cc.cc
|
||||
pkgs_i686.glibc
|
||||
pkgsi686Linux.glibc
|
||||
expat
|
||||
freetype
|
||||
nss
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
sha256 = "1wg61h4gndm3vcprdcg7rc4s1v3jkm5xd7lw8r2f67w502y94gcy";
|
||||
}),
|
||||
pkgs ? import nixpkgsSource {},
|
||||
pkgs_i686 ? import nixpkgsSource { system = "i686-linux"; },*/
|
||||
pkgsi686Linux ? import nixpkgsSource { system = "i686-linux"; },*/
|
||||
|
||||
# If you want to use the in-tree version of nixpkgs:
|
||||
pkgs ? import ../../../../.. {},
|
||||
pkgs_i686 ? import ../../../../.. { system = "i686-linux"; },
|
||||
pkgsi686Linux ? import ../../../../.. { system = "i686-linux"; },
|
||||
|
||||
config ? pkgs.config
|
||||
}:
|
||||
|
@ -46,13 +46,13 @@ let
|
|||
};
|
||||
|
||||
androidEnv = pkgs.callPackage "${androidEnvNixpkgs}/pkgs/development/mobile/androidenv" {
|
||||
inherit config pkgs pkgs_i686;
|
||||
inherit config pkgs pkgsi686Linux;
|
||||
licenseAccepted = true;
|
||||
};*/
|
||||
|
||||
# Otherwise, just use the in-tree androidenv:
|
||||
androidEnv = pkgs.callPackage ./.. {
|
||||
inherit config pkgs pkgs_i686;
|
||||
inherit config pkgs pkgsi686Linux;
|
||||
licenseAccepted = true;
|
||||
};
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
deployAndroidPackage {
|
||||
inherit package os;
|
||||
buildInputs = lib.optionals (os == "linux") [ autoPatchelfHook pkgs.glibc pkgs.zlib pkgs.ncurses5 ];
|
||||
nativeBuildInputs = lib.optionals (os == "linux") [ autoPatchelfHook ];
|
||||
buildInputs = lib.optionals (os == "linux") [ pkgs.glibc pkgs.zlib pkgs.ncurses5 ];
|
||||
patchInstructions = lib.optionalString (os == "linux") ''
|
||||
addAutoPatchelfSearchPath $packageBaseDir/lib64
|
||||
autoPatchelf --no-recurse $packageBaseDir/lib64
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{deployAndroidPackage, requireFile, lib, packages, toolsVersion, autoPatchelfHook, makeWrapper, os, pkgs, pkgs_i686, postInstall ? ""}:
|
||||
{deployAndroidPackage, requireFile, lib, packages, toolsVersion, os, callPackage, postInstall ? ""}:
|
||||
|
||||
if toolsVersion == "26.0.1" then import ./tools/26.nix {
|
||||
inherit deployAndroidPackage lib autoPatchelfHook makeWrapper os pkgs pkgs_i686 postInstall;
|
||||
if toolsVersion == "26.0.1" then callPackage ./tools/26.nix {
|
||||
inherit deployAndroidPackage lib os postInstall;
|
||||
package = {
|
||||
name = "tools";
|
||||
path = "tools";
|
||||
|
@ -17,10 +17,10 @@ if toolsVersion == "26.0.1" then import ./tools/26.nix {
|
|||
};
|
||||
};
|
||||
};
|
||||
} else if toolsVersion == "26.1.1" then import ./tools/26.nix {
|
||||
inherit deployAndroidPackage lib autoPatchelfHook makeWrapper os pkgs pkgs_i686 postInstall;
|
||||
} else if toolsVersion == "26.1.1" then callPackage ./tools/26.nix {
|
||||
inherit deployAndroidPackage lib os postInstall;
|
||||
package = packages.tools.${toolsVersion};
|
||||
} else import ./tools/25.nix {
|
||||
inherit deployAndroidPackage lib autoPatchelfHook makeWrapper os pkgs pkgs_i686 postInstall;
|
||||
} else callPackage ./tools/25.nix {
|
||||
inherit deployAndroidPackage lib os postInstall;
|
||||
package = packages.tools.${toolsVersion};
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{deployAndroidPackage, lib, package, autoPatchelfHook, makeWrapper, os, pkgs, pkgs_i686, postInstall ? ""}:
|
||||
{deployAndroidPackage, lib, package, autoPatchelfHook, makeWrapper, os, pkgs, pkgsi686Linux, postInstall ? ""}:
|
||||
|
||||
deployAndroidPackage {
|
||||
name = "androidsdk";
|
||||
nativeBuildInputs = [ autoPatchelfHook makeWrapper ];
|
||||
buildInputs = lib.optionals (os == "linux") [ pkgs.glibc pkgs.xorg.libX11 pkgs.xorg.libXext pkgs.xorg.libXdamage pkgs.xorg.libxcb pkgs.xorg.libXfixes pkgs.xorg.libXrender pkgs.fontconfig.lib pkgs.freetype pkgs.libGL pkgs.zlib pkgs.ncurses5 pkgs.libpulseaudio pkgs_i686.glibc pkgs_i686.xorg.libX11 pkgs_i686.xorg.libXrender pkgs_i686.fontconfig pkgs_i686.freetype pkgs_i686.zlib ];
|
||||
buildInputs = lib.optionals (os == "linux") [ pkgs.glibc pkgs.xorg.libX11 pkgs.xorg.libXext pkgs.xorg.libXdamage pkgs.xorg.libxcb pkgs.xorg.libXfixes pkgs.xorg.libXrender pkgs.fontconfig.lib pkgs.freetype pkgs.libGL pkgs.zlib pkgs.ncurses5 pkgs.libpulseaudio pkgsi686Linux.glibc pkgsi686Linux.xorg.libX11 pkgsi686Linux.xorg.libXrender pkgsi686Linux.fontconfig pkgsi686Linux.freetype pkgsi686Linux.zlib ];
|
||||
inherit package os;
|
||||
|
||||
patchInstructions = ''
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{deployAndroidPackage, lib, package, autoPatchelfHook, makeWrapper, os, pkgs, pkgs_i686, postInstall ? ""}:
|
||||
{deployAndroidPackage, lib, package, autoPatchelfHook, makeWrapper, os, pkgs, pkgsi686Linux, postInstall ? ""}:
|
||||
|
||||
deployAndroidPackage {
|
||||
name = "androidsdk";
|
||||
|
@ -8,7 +8,7 @@ deployAndroidPackage {
|
|||
buildInputs = lib.optional (os == "linux") (
|
||||
(with pkgs; [ glibc freetype fontconfig fontconfig.lib])
|
||||
++ (with pkgs.xorg; [ libX11 libXrender libXext ])
|
||||
++ (with pkgs_i686; [ glibc xorg.libX11 xorg.libXrender xorg.libXext fontconfig.lib freetype zlib ])
|
||||
++ (with pkgsi686Linux; [ glibc xorg.libX11 xorg.libXrender xorg.libXext fontconfig.lib freetype zlib ])
|
||||
);
|
||||
|
||||
patchInstructions = ''
|
||||
|
|
|
@ -3359,9 +3359,7 @@ with pkgs;
|
|||
|
||||
anbox = callPackage ../os-specific/linux/anbox { };
|
||||
|
||||
androidenv = callPackage ../development/mobile/androidenv {
|
||||
pkgs_i686 = pkgsi686Linux;
|
||||
};
|
||||
androidenv = callPackage ../development/mobile/androidenv { };
|
||||
|
||||
androidndkPkgs = androidndkPkgs_21;
|
||||
androidndkPkgs_21 = (callPackage ../development/androidndk-pkgs {})."21";
|
||||
|
|
Loading…
Reference in a new issue