pkgs/development/mobile: stdenv.lib -> lib

This commit is contained in:
Pavol Rusnak 2021-01-17 18:28:51 +01:00
parent 7ed3d2df76
commit c3bbfb77ad
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
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 -m444 ./debian/abootimg.1 $out/share/man/man1/abootimg.1;
install -D -m 755 abootimg-pack-initrd $out/bin 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 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; { meta = with lib; {

View File

@ -19,7 +19,7 @@ stdenv.mkDerivation {
dontBuild = true; dontBuild = true;
installPhase = let installPhase = let
dependencies = stdenv.lib.makeBinPath [ platform-tools socat go-mtpfs adbfs-rootless ]; dependencies = lib.makeBinPath [ platform-tools socat go-mtpfs adbfs-rootless ];
in '' in ''
runHook preInstall 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: # TODO:
# #
@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
sed -i \ sed -i \
-e 's|$(uname -m)|i686|' \ -e 's|$(uname -m)|i686|' \
-e 's|export JAVA_HOME=.*|export JAVA_HOME=${jre}|' \ -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 FlashTool FlashToolConsole
''; '';
@ -51,12 +51,12 @@ stdenv.mkDerivation rec {
mv * $out/ mv * $out/
''; '';
meta = { meta = with lib; {
homepage = "http://www.flashtool.net/"; homepage = "http://www.flashtool.net/";
description = "S1 flashing software for Sony phones from X10 to Xperia Z Ultra"; description = "S1 flashing software for Sony phones from X10 to Xperia Z Ultra";
license = stdenv.lib.licenses.unfreeRedistributableFirmware; license = licenses.unfreeRedistributableFirmware;
platforms = [ "i686-linux" ]; platforms = [ "i686-linux" ];
hydraPlatforms = stdenv.lib.platforms.none; hydraPlatforms = platforms.none;
broken = true; 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 , xdg_utils
# For glewinfo # For glewinfo
, libXmu, libXi, libXext }: , libXmu, libXi, libXext }:
@ -7,7 +7,7 @@ let
packages = [ packages = [
stdenv.cc.cc zlib glib xorg.libX11 libxkbcommon libXmu libXi libXext libGL stdenv.cc.cc zlib glib xorg.libX11 libxkbcommon libXmu libXi libXext libGL
]; ];
libPath = stdenv.lib.makeLibraryPath packages; libPath = lib.makeLibraryPath packages;
in in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "genymotion"; pname = "genymotion";
@ -66,7 +66,7 @@ stdenv.mkDerivation rec {
rm $out/libexec/genymotion/libxkbcommon* rm $out/libexec/genymotion/libxkbcommon*
''; '';
meta = { meta = with lib; {
description = "Fast and easy Android emulation"; description = "Fast and easy Android emulation";
longDescription = '' longDescription = ''
Genymotion is a relatively fast Android emulator which comes with Genymotion is a relatively fast Android emulator which comes with
@ -74,8 +74,8 @@ stdenv.mkDerivation rec {
suitable for application testing. suitable for application testing.
''; '';
homepage = "https://www.genymotion.com/"; homepage = "https://www.genymotion.com/";
license = stdenv.lib.licenses.unfree; license = licenses.unfree;
platforms = ["x86_64-linux"]; 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 { name, src, preBuild ? "", target, tiVersion ? null
, release ? false, androidKeyStore ? null, androidKeyAlias ? null, androidKeyStorePassword ? null , release ? false, androidKeyStore ? null, androidKeyAlias ? null, androidKeyStorePassword ? null
, iosMobileProvisioningProfile ? null, iosCertificateName ? null, iosCertificate ? null, iosCertificatePassword ? null, iosVersion ? "12.1", iosBuildStore ? false , 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" ]; extraArgs = removeAttrs args [ "name" "preRebuild" "androidsdkArgs" "xcodewrapperArgs" ];
in in
stdenv.mkDerivation ({ stdenv.mkDerivation ({
name = stdenv.lib.replaceChars [" "] [""] name; name = lib.replaceChars [" "] [""] name;
buildInputs = [ nodejs titanium alloy python which file jdk ]; buildInputs = [ nodejs titanium alloy python which file jdk ];
buildPhase = '' buildPhase = ''
${preBuild} ${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. # 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))/.. alloy=$(dirname $(type -p alloy))/..
cp -rv $alloy/* alloy cp -rv $alloy/* alloy
@ -51,7 +51,7 @@ stdenv.mkDerivation ({
export HOME=${if target == "iphone" then "/Users/$(whoami)" else "$TMPDIR"} 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 # 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 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 export GRADLE_USER_HOME=$TMPDIR/gradle
${if release then '' ${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 # Signing the app does not work with OpenJDK on macOS, use host SDK instead
export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)" export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"
''} ''}
@ -171,7 +171,7 @@ stdenv.mkDerivation ({
mkdir -p $out/nix-support mkdir -p $out/nix-support
echo "file binary-dist \"$(echo $out/*.ipa)\"" > $out/nix-support/hydra-build-products 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)" 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') 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') 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!"} else throw "Target: ${target} is not supported!"}
''; '';
failureHook = stdenv.lib.optionalString (release && target == "iphone") deleteKeychain; failureHook = lib.optionalString (release && target == "iphone") deleteKeychain;
} // extraArgs) } // extraArgs)

View File

@ -8,11 +8,11 @@ rec {
else throw "Titanium version not supported: "+tiVersion; else throw "Titanium version not supported: "+tiVersion;
in in
import titaniumSdkFile { import titaniumSdkFile {
inherit (pkgs) stdenv fetchurl unzip makeWrapper; inherit (pkgs) stdenv lib fetchurl unzip makeWrapper;
}; };
buildApp = import ./build-app.nix { 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 (pkgs.nodePackages) alloy titanium;
inherit (androidenv) composeAndroidPackages; inherit (androidenv) composeAndroidPackages;
inherit (xcodeenv) composeXcodeWrapper; inherit (xcodeenv) composeXcodeWrapper;

View File

@ -1,4 +1,4 @@
{stdenv, fetchurl, unzip, makeWrapper}: {stdenv, lib, fetchurl, unzip, makeWrapper}:
let let
# Gradle is a build system that bootstraps itself. This is what it actually # 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 # 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 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 # 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 # it skip the strip phase. This is caused by an assumption on the file
# permissions in which Nix deviates from the standard. # permissions in which Nix deviates from the standard.

View File

@ -1,4 +1,4 @@
{stdenv, fetchurl, unzip, makeWrapper}: {stdenv, lib, fetchurl, unzip, makeWrapper}:
let let
# Gradle is a build system that bootstraps itself. This is what it actually # 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 # 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 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 # 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 # it skip the strip phase. This is caused by an assumption on the file
# permissions in which Nix deviates from the standard. # permissions in which Nix deviates from the standard.

View File

@ -1,4 +1,4 @@
{stdenv, composeXcodeWrapper}: {stdenv, lib, composeXcodeWrapper}:
{ name { name
, src , src
, sdkVersion ? "13.1" , 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); extraArgs = removeAttrs args ([ "name" "scheme" "xcodeFlags" "release" "certificateFile" "certificatePassword" "provisioningProfile" "signMethod" "generateIPA" "generateXCArchive" "enableWirelessDistribution" "installURL" "bundleId" "version" ] ++ builtins.attrNames xcodewrapperFormalArgs);
in in
stdenv.mkDerivation ({ 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 = '' buildPhase = ''
# Be sure that the Xcode wrapper has priority over everything else. # Be sure that the Xcode wrapper has priority over everything else.
# When using buildInputs this does not seem to be the case. # When using buildInputs this does not seem to be the case.
export PATH=${xcodewrapper}/bin:$PATH export PATH=${xcodewrapper}/bin:$PATH
${stdenv.lib.optionalString release '' ${lib.optionalString release ''
export HOME=/Users/$(whoami) export HOME=/Users/$(whoami)
keychainName="$(basename $out)" keychainName="$(basename $out)"
@ -91,10 +91,10 @@ stdenv.mkDerivation ({
# Do the building # 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 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 '' ${lib.optionalString release ''
${stdenv.lib.optionalString generateIPA '' ${lib.optionalString generateIPA ''
# Create export plist file # Create export plist file
cat > "${name}.plist" <<EOF cat > "${name}.plist" <<EOF
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
@ -112,7 +112,7 @@ stdenv.mkDerivation ({
<string>manual</string> <string>manual</string>
<key>method</key> <key>method</key>
<string>${signMethod}</string> <string>${signMethod}</string>
${stdenv.lib.optionalString (signMethod == "enterprise" || signMethod == "ad-hoc") '' ${lib.optionalString (signMethod == "enterprise" || signMethod == "ad-hoc") ''
<key>compileBitcode</key> <key>compileBitcode</key>
<false/> <false/>
''} ''}
@ -127,14 +127,14 @@ stdenv.mkDerivation ({
mkdir -p $out/nix-support mkdir -p $out/nix-support
echo "file binary-dist \"$(echo $out/*.ipa)\"" > $out/nix-support/hydra-build-products 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 # Add another hacky build product that enables wireless adhoc installations
appname="$(basename "$(echo $out/*.ipa)" .ipa)" 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 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 echo "doc install \"$out/''${appname}.html\"" >> $out/nix-support/hydra-build-products
''} ''}
''} ''}
${stdenv.lib.optionalString generateXCArchive '' ${lib.optionalString generateXCArchive ''
mkdir -p $out mkdir -p $out
mv "${name}.xcarchive" $out mv "${name}.xcarchive" $out
''} ''}
@ -144,7 +144,7 @@ stdenv.mkDerivation ({
''} ''}
''; '';
failureHook = stdenv.lib.optionalString release deleteKeychain; failureHook = lib.optionalString release deleteKeychain;
installPhase = "true"; installPhase = "true";
} // extraArgs) } // extraArgs)

View File

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