Merge pull request #109655 from prusnak/stdenv-lib-mobile

pkgs/development/mobile: stdenv.lib -> lib
This commit is contained in:
Pavol Rusnak 2021-01-23 12:11:03 +01:00 committed by GitHub
commit a6f6f739c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 42 additions and 42 deletions

View file

@ -28,10 +28,10 @@ stdenv.mkDerivation {
install -D -m444 ./debian/abootimg.1 $out/share/man/man1/abootimg.1;
install -D -m 755 abootimg-pack-initrd $out/bin
wrapProgram $out/bin/abootimg-pack-initrd --prefix PATH : ${stdenv.lib.makeBinPath [ coreutils cpio findutils gzip ]}
wrapProgram $out/bin/abootimg-pack-initrd --prefix PATH : ${lib.makeBinPath [ coreutils cpio findutils gzip ]}
install -D -m 755 abootimg-unpack-initrd $out/bin
wrapProgram $out/bin/abootimg-unpack-initrd --prefix PATH : ${stdenv.lib.makeBinPath [ cpio gzip ]}
wrapProgram $out/bin/abootimg-unpack-initrd --prefix PATH : ${lib.makeBinPath [ cpio gzip ]}
'';
meta = with lib; {

View file

@ -19,7 +19,7 @@ stdenv.mkDerivation {
dontBuild = true;
installPhase = let
dependencies = stdenv.lib.makeBinPath [ platform-tools socat go-mtpfs adbfs-rootless ];
dependencies = lib.makeBinPath [ platform-tools socat go-mtpfs adbfs-rootless ];
in ''
runHook preInstall

View file

@ -1,4 +1,4 @@
{ stdenv, requireFile, p7zip, jre, libusb1, platform-tools, gtk2, glib, libXtst }:
{ stdenv, lib, requireFile, p7zip, jre, libusb1, platform-tools, gtk2, glib, libXtst }:
# TODO:
#
@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
sed -i \
-e 's|$(uname -m)|i686|' \
-e 's|export JAVA_HOME=.*|export JAVA_HOME=${jre}|' \
-e 's|export LD_LIBRARY_PATH=.*|export LD_LIBRARY_PATH=${stdenv.lib.makeLibraryPath [ libXtst glib gtk2 ]}:./x10flasher_lib/linux/lib32|' \
-e 's|export LD_LIBRARY_PATH=.*|export LD_LIBRARY_PATH=${lib.makeLibraryPath [ libXtst glib gtk2 ]}:./x10flasher_lib/linux/lib32|' \
FlashTool FlashToolConsole
'';
@ -51,12 +51,12 @@ stdenv.mkDerivation rec {
mv * $out/
'';
meta = {
meta = with lib; {
homepage = "http://www.flashtool.net/";
description = "S1 flashing software for Sony phones from X10 to Xperia Z Ultra";
license = stdenv.lib.licenses.unfreeRedistributableFirmware;
license = licenses.unfreeRedistributableFirmware;
platforms = [ "i686-linux" ];
hydraPlatforms = stdenv.lib.platforms.none;
hydraPlatforms = platforms.none;
broken = true;
};
}

View file

@ -1,4 +1,4 @@
{ stdenv, fetchurl, makeWrapper, which, zlib, libGL, glib, xorg, libxkbcommon
{ stdenv, lib, fetchurl, makeWrapper, which, zlib, libGL, glib, xorg, libxkbcommon
, xdg_utils
# For glewinfo
, libXmu, libXi, libXext }:
@ -7,7 +7,7 @@ let
packages = [
stdenv.cc.cc zlib glib xorg.libX11 libxkbcommon libXmu libXi libXext libGL
];
libPath = stdenv.lib.makeLibraryPath packages;
libPath = lib.makeLibraryPath packages;
in
stdenv.mkDerivation rec {
pname = "genymotion";
@ -66,7 +66,7 @@ stdenv.mkDerivation rec {
rm $out/libexec/genymotion/libxkbcommon*
'';
meta = {
meta = with lib; {
description = "Fast and easy Android emulation";
longDescription = ''
Genymotion is a relatively fast Android emulator which comes with
@ -74,8 +74,8 @@ stdenv.mkDerivation rec {
suitable for application testing.
'';
homepage = "https://www.genymotion.com/";
license = stdenv.lib.licenses.unfree;
license = licenses.unfree;
platforms = ["x86_64-linux"];
maintainers = [ stdenv.lib.maintainers.puffnfresh ];
maintainers = [ maintainers.puffnfresh ];
};
}

View file

@ -1,4 +1,4 @@
{stdenv, composeAndroidPackages, composeXcodeWrapper, titaniumsdk, titanium, alloy, jdk, python, nodejs, which, file}:
{stdenv, lib, composeAndroidPackages, composeXcodeWrapper, titaniumsdk, titanium, alloy, jdk, python, nodejs, which, file}:
{ name, src, preBuild ? "", target, tiVersion ? null
, release ? false, androidKeyStore ? null, androidKeyAlias ? null, androidKeyStorePassword ? null
, iosMobileProvisioningProfile ? null, iosCertificateName ? null, iosCertificate ? null, iosCertificatePassword ? null, iosVersion ? "12.1", iosBuildStore ? false
@ -34,14 +34,14 @@ let
extraArgs = removeAttrs args [ "name" "preRebuild" "androidsdkArgs" "xcodewrapperArgs" ];
in
stdenv.mkDerivation ({
name = stdenv.lib.replaceChars [" "] [""] name;
name = lib.replaceChars [" "] [""] name;
buildInputs = [ nodejs titanium alloy python which file jdk ];
buildPhase = ''
${preBuild}
${stdenv.lib.optionalString stdenv.isDarwin ''
${lib.optionalString stdenv.isDarwin ''
# Hack that provides a writable alloy package on macOS. Without it the build fails because of a file permission error.
alloy=$(dirname $(type -p alloy))/..
cp -rv $alloy/* alloy
@ -51,7 +51,7 @@ stdenv.mkDerivation ({
export HOME=${if target == "iphone" then "/Users/$(whoami)" else "$TMPDIR"}
${stdenv.lib.optionalString (tiVersion != null) ''
${lib.optionalString (tiVersion != null) ''
# Replace titanium version by the provided one
sed -i -e "s|<sdk-version>[0-9a-zA-Z\.]*</sdk-version>|<sdk-version>${tiVersion}</sdk-version>|" tiapp.xml
''}
@ -76,7 +76,7 @@ stdenv.mkDerivation ({
export GRADLE_USER_HOME=$TMPDIR/gradle
${if release then ''
${stdenv.lib.optionalString stdenv.isDarwin ''
${lib.optionalString stdenv.isDarwin ''
# Signing the app does not work with OpenJDK on macOS, use host SDK instead
export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"
''}
@ -171,7 +171,7 @@ stdenv.mkDerivation ({
mkdir -p $out/nix-support
echo "file binary-dist \"$(echo $out/*.ipa)\"" > $out/nix-support/hydra-build-products
${stdenv.lib.optionalString enableWirelessDistribution ''
${lib.optionalString enableWirelessDistribution ''
appname="$(basename $out/*.ipa .ipa)"
bundleId=$(grep '<id>[a-zA-Z0-9.]*</id>' tiapp.xml | sed -e 's|<id>||' -e 's|</id>||' -e 's/ //g')
version=$(grep '<version>[a-zA-Z0-9.]*</version>' tiapp.xml | sed -e 's|<version>||' -e 's|</version>||' -e 's/ //g')
@ -184,5 +184,5 @@ stdenv.mkDerivation ({
else throw "Target: ${target} is not supported!"}
'';
failureHook = stdenv.lib.optionalString (release && target == "iphone") deleteKeychain;
failureHook = lib.optionalString (release && target == "iphone") deleteKeychain;
} // extraArgs)

View file

@ -8,11 +8,11 @@ rec {
else throw "Titanium version not supported: "+tiVersion;
in
import titaniumSdkFile {
inherit (pkgs) stdenv fetchurl unzip makeWrapper;
inherit (pkgs) stdenv lib fetchurl unzip makeWrapper;
};
buildApp = import ./build-app.nix {
inherit (pkgs) stdenv python which file jdk nodejs;
inherit (pkgs) stdenv lib python which file jdk nodejs;
inherit (pkgs.nodePackages) alloy titanium;
inherit (androidenv) composeAndroidPackages;
inherit (xcodeenv) composeXcodeWrapper;

View file

@ -1,4 +1,4 @@
{stdenv, fetchurl, unzip, makeWrapper}:
{stdenv, lib, fetchurl, unzip, makeWrapper}:
let
# Gradle is a build system that bootstraps itself. This is what it actually
@ -87,7 +87,7 @@ stdenv.mkDerivation {
# Patch maven central repository with our own local directory. This prevents the builder from downloading Maven artifacts
sed -i -e 's|mavenCentral()|maven { url "${fakeMavenRepo}" }|' android/templates/build/proguard.gradle
${stdenv.lib.optionalString (stdenv.system == "x86_64-darwin") ''
${lib.optionalString (stdenv.system == "x86_64-darwin") ''
# Patch the strip frameworks script in the iPhone build template to not let
# it skip the strip phase. This is caused by an assumption on the file
# permissions in which Nix deviates from the standard.

View file

@ -1,4 +1,4 @@
{stdenv, fetchurl, unzip, makeWrapper}:
{stdenv, lib, fetchurl, unzip, makeWrapper}:
let
# Gradle is a build system that bootstraps itself. This is what it actually
@ -87,7 +87,7 @@ stdenv.mkDerivation {
# Patch maven central repository with our own local directory. This prevents the builder from downloading Maven artifacts
sed -i -e 's|mavenCentral()|maven { url "${fakeMavenRepo}" }|' android/templates/build/proguard.gradle
${stdenv.lib.optionalString (stdenv.system == "x86_64-darwin") ''
${lib.optionalString (stdenv.system == "x86_64-darwin") ''
# Patch the strip frameworks script in the iPhone build template to not let
# it skip the strip phase. This is caused by an assumption on the file
# permissions in which Nix deviates from the standard.

View file

@ -1,4 +1,4 @@
{stdenv, composeXcodeWrapper}:
{stdenv, lib, composeXcodeWrapper}:
{ name
, src
, sdkVersion ? "13.1"
@ -53,13 +53,13 @@ let
extraArgs = removeAttrs args ([ "name" "scheme" "xcodeFlags" "release" "certificateFile" "certificatePassword" "provisioningProfile" "signMethod" "generateIPA" "generateXCArchive" "enableWirelessDistribution" "installURL" "bundleId" "version" ] ++ builtins.attrNames xcodewrapperFormalArgs);
in
stdenv.mkDerivation ({
name = stdenv.lib.replaceChars [" "] [""] name; # iOS app names can contain spaces, but in the Nix store this is not allowed
name = lib.replaceChars [" "] [""] name; # iOS app names can contain spaces, but in the Nix store this is not allowed
buildPhase = ''
# Be sure that the Xcode wrapper has priority over everything else.
# When using buildInputs this does not seem to be the case.
export PATH=${xcodewrapper}/bin:$PATH
${stdenv.lib.optionalString release ''
${lib.optionalString release ''
export HOME=/Users/$(whoami)
keychainName="$(basename $out)"
@ -91,10 +91,10 @@ stdenv.mkDerivation ({
# Do the building
export LD=/usr/bin/clang # To avoid problem with -isysroot parameter that is unrecognized by the stock ld. Comparison with an impure build shows that it uses clang instead. Ugly, but it works
xcodebuild -target ${_target} -configuration ${_configuration} ${stdenv.lib.optionalString (scheme != null) "-scheme ${scheme}"} -sdk ${_sdk} TARGETED_DEVICE_FAMILY="1, 2" ONLY_ACTIVE_ARCH=NO CONFIGURATION_TEMP_DIR=$TMPDIR CONFIGURATION_BUILD_DIR=$out ${if generateIPA || generateXCArchive then "-archivePath \"${name}.xcarchive\" archive" else ""} ${if release then '' PROVISIONING_PROFILE=$PROVISIONING_PROFILE OTHER_CODE_SIGN_FLAGS="--keychain $HOME/Library/Keychains/$keychainName-db"'' else ""} ${xcodeFlags}
xcodebuild -target ${_target} -configuration ${_configuration} ${lib.optionalString (scheme != null) "-scheme ${scheme}"} -sdk ${_sdk} TARGETED_DEVICE_FAMILY="1, 2" ONLY_ACTIVE_ARCH=NO CONFIGURATION_TEMP_DIR=$TMPDIR CONFIGURATION_BUILD_DIR=$out ${if generateIPA || generateXCArchive then "-archivePath \"${name}.xcarchive\" archive" else ""} ${if release then '' PROVISIONING_PROFILE=$PROVISIONING_PROFILE OTHER_CODE_SIGN_FLAGS="--keychain $HOME/Library/Keychains/$keychainName-db"'' else ""} ${xcodeFlags}
${stdenv.lib.optionalString release ''
${stdenv.lib.optionalString generateIPA ''
${lib.optionalString release ''
${lib.optionalString generateIPA ''
# Create export plist file
cat > "${name}.plist" <<EOF
<?xml version="1.0" encoding="UTF-8"?>
@ -112,7 +112,7 @@ stdenv.mkDerivation ({
<string>manual</string>
<key>method</key>
<string>${signMethod}</string>
${stdenv.lib.optionalString (signMethod == "enterprise" || signMethod == "ad-hoc") ''
${lib.optionalString (signMethod == "enterprise" || signMethod == "ad-hoc") ''
<key>compileBitcode</key>
<false/>
''}
@ -127,14 +127,14 @@ stdenv.mkDerivation ({
mkdir -p $out/nix-support
echo "file binary-dist \"$(echo $out/*.ipa)\"" > $out/nix-support/hydra-build-products
${stdenv.lib.optionalString enableWirelessDistribution ''
${lib.optionalString enableWirelessDistribution ''
# Add another hacky build product that enables wireless adhoc installations
appname="$(basename "$(echo $out/*.ipa)" .ipa)"
sed -e "s|@INSTALL_URL@|${installURL}?bundleId=${bundleId}\&amp;version=${appVersion}\&amp;title=$appname|" ${./install.html.template} > $out/''${appname}.html
echo "doc install \"$out/''${appname}.html\"" >> $out/nix-support/hydra-build-products
''}
''}
${stdenv.lib.optionalString generateXCArchive ''
${lib.optionalString generateXCArchive ''
mkdir -p $out
mv "${name}.xcarchive" $out
''}
@ -144,7 +144,7 @@ stdenv.mkDerivation ({
''}
'';
failureHook = stdenv.lib.optionalString release deleteKeychain;
failureHook = lib.optionalString release deleteKeychain;
installPhase = "true";
} // extraArgs)

View file

@ -1,4 +1,4 @@
{stdenv}:
{ stdenv, lib }:
rec {
composeXcodeWrapper = import ./compose-xcodewrapper.nix {
@ -6,10 +6,10 @@ rec {
};
buildApp = import ./build-app.nix {
inherit stdenv composeXcodeWrapper;
inherit stdenv lib composeXcodeWrapper;
};
simulateApp = import ./simulate-app.nix {
inherit stdenv composeXcodeWrapper;
inherit stdenv lib composeXcodeWrapper;
};
}

View file

@ -1,4 +1,4 @@
{stdenv, composeXcodeWrapper}:
{stdenv, lib, composeXcodeWrapper}:
{name, app ? null, bundleId ? null, ...}@args:
assert app != null -> bundleId != null;
@ -9,7 +9,7 @@ let
xcodewrapper = composeXcodeWrapper xcodewrapperArgs;
in
stdenv.mkDerivation {
name = stdenv.lib.replaceChars [" "] [""] name;
name = lib.replaceChars [" "] [""] name;
buildCommand = ''
mkdir -p $out/bin
cat > $out/bin/run-test-simulator << "EOF"
@ -30,7 +30,7 @@ stdenv.mkDerivation {
# Open the simulator instance
open -a "$(readlink "${xcodewrapper}/bin/Simulator")" --args -CurrentDeviceUDID $udid
${stdenv.lib.optionalString (app != null) ''
${lib.optionalString (app != null) ''
# Copy the app and restore the write permissions
appTmpDir=$(mktemp -d -t appTmpDir)
cp -r "$(echo ${app}/*.app)" "$appTmpDir"