stdenv.lib -> lib

This commit is contained in:
ajs124 2021-02-16 19:37:13 +01:00
parent 972f66ab44
commit 373fcc8b90
2 changed files with 13 additions and 13 deletions

View file

@ -4,7 +4,7 @@
let let
composerEnv = import ./src/Composer2Nix/composer-env.nix { composerEnv = import ./src/Composer2Nix/composer-env.nix {
inherit (pkgs) stdenv writeTextFile fetchurl php unzip phpPackages; inherit (pkgs) stdenv lib writeTextFile fetchurl php unzip phpPackages;
}; };
in in
import ./php-packages.nix { import ./php-packages.nix {

View file

@ -1,6 +1,6 @@
# This file originates from composer2nix # This file originates from composer2nix
{ stdenv, writeTextFile, fetchurl, php, unzip, phpPackages }: { stdenv, lib, writeTextFile, fetchurl, php, unzip, phpPackages }:
let let
inherit (phpPackages) composer; inherit (phpPackages) composer;
@ -57,7 +57,7 @@ let
else else
$allPackages = array(); $allPackages = array();
${stdenv.lib.optionalString (!noDev) '' ${lib.optionalString (!noDev) ''
if(array_key_exists("packages-dev", $config)) if(array_key_exists("packages-dev", $config))
$allPackages = array_merge($allPackages, $config["packages-dev"]); $allPackages = array_merge($allPackages, $config["packages-dev"]);
''} ''}
@ -108,7 +108,7 @@ let
}; };
bundleDependencies = dependencies: bundleDependencies = dependencies:
stdenv.lib.concatMapStrings (dependencyName: lib.concatMapStrings (dependencyName:
let let
dependency = dependencies.${dependencyName}; dependency = dependencies.${dependencyName};
in in
@ -179,24 +179,24 @@ let
# Copy or symlink the provided dependencies # Copy or symlink the provided dependencies
cd vendor cd vendor
${bundleDependencies packages} ${bundleDependencies packages}
${stdenv.lib.optionalString (!noDev) (bundleDependencies devPackages)} ${lib.optionalString (!noDev) (bundleDependencies devPackages)}
cd .. cd ..
# Reconstruct autoload scripts # Reconstruct autoload scripts
# We use the optimize feature because Nix packages cannot change after they have been built # We use the optimize feature because Nix packages cannot change after they have been built
# Using the dynamic loader for a Nix package is useless since there is nothing to dynamically reload. # Using the dynamic loader for a Nix package is useless since there is nothing to dynamically reload.
composer dump-autoload --optimize ${stdenv.lib.optionalString noDev "--no-dev"} composer dump-autoload --optimize ${lib.optionalString noDev "--no-dev"}
# Run the install step as a validation to confirm that everything works out as expected # Run the install step as a validation to confirm that everything works out as expected
composer install --optimize-autoloader ${stdenv.lib.optionalString noDev "--no-dev"} composer install --optimize-autoloader ${lib.optionalString noDev "--no-dev"}
${stdenv.lib.optionalString executable '' ${lib.optionalString executable ''
# Reconstruct the bin/ folder if we deploy an executable project # Reconstruct the bin/ folder if we deploy an executable project
${constructBin} composer.json ${constructBin} composer.json
ln -s $(pwd)/vendor/bin $out/bin ln -s $(pwd)/vendor/bin $out/bin
''} ''}
${stdenv.lib.optionalString (!symlinkDependencies) '' ${lib.optionalString (!symlinkDependencies) ''
# Patch the shebangs if possible # Patch the shebangs if possible
if [ -d $(pwd)/vendor/bin ] if [ -d $(pwd)/vendor/bin ]
then then
@ -232,7 +232,7 @@ let
} // extraArgs); } // extraArgs);
in in
{ {
composer = stdenv.lib.makeOverridable composer; composer = lib.makeOverridable composer;
buildZipPackage = stdenv.lib.makeOverridable buildZipPackage; buildZipPackage = lib.makeOverridable buildZipPackage;
buildPackage = stdenv.lib.makeOverridable buildPackage; buildPackage = lib.makeOverridable buildPackage;
} }