Remove usage of stdenv.lib

This commit is contained in:
Sandro Jäckel 2021-04-01 21:31:05 +02:00 committed by Cole Helbling
parent 6adac57ee9
commit 231953bf2e
3 changed files with 19 additions and 19 deletions

View file

@ -1,6 +1,6 @@
# This file originates from composer2nix # This file originates from composer2nix
{ stdenv, writeTextFile, fetchurl, php, unzip }: { stdenv, lib, writeTextFile, fetchurl, php, unzip }:
let let
composer = stdenv.mkDerivation { composer = stdenv.mkDerivation {
@ -31,8 +31,8 @@ let
meta = { meta = {
description = "Dependency Manager for PHP"; description = "Dependency Manager for PHP";
#license = stdenv.licenses.mit; #license = stdenv.licenses.mit;
maintainers = [ stdenv.lib.maintainers.sander ]; maintainers = [ lib.maintainers.sander ];
platforms = stdenv.lib.platforms.unix; platforms = lib.platforms.unix;
}; };
}; };
@ -89,7 +89,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"]);
''} ''}
@ -140,7 +140,7 @@ let
}; };
bundleDependencies = dependencies: bundleDependencies = dependencies:
stdenv.lib.concatMapStrings (dependencyName: lib.concatMapStrings (dependencyName:
let let
dependency = dependencies.${dependencyName}; dependency = dependencies.${dependencyName};
in in
@ -211,24 +211,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
@ -264,7 +264,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;
} }

View file

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

View file

@ -17,7 +17,7 @@ let
oldpkgs = import oldpkgsSrc {}; oldpkgs = import oldpkgsSrc {};
inherit (pkgs) stdenv; inherit (pkgs) stdenv lib;
phpEnv = stdenv.mkDerivation rec { phpEnv = stdenv.mkDerivation rec {
name = "gh-event-forwarder"; name = "gh-event-forwarder";
@ -43,7 +43,7 @@ let
pkg-config pkg-config
openssl openssl
] ]
++ stdenv.lib.optional stdenv.isDarwin pkgs.darwin.Security; ++ lib.optional stdenv.isDarwin pkgs.darwin.Security;
postHook = '' postHook = ''
checkPhase() ( checkPhase() (
@ -67,7 +67,7 @@ let
RUST_BACKTRACE = "1"; RUST_BACKTRACE = "1";
NIX_PATH = "nixpkgs=${pkgs.path}"; NIX_PATH = "nixpkgs=${pkgs.path}";
} }
// stdenv.lib.optionalAttrs stdenv.isLinux { // lib.optionalAttrs stdenv.isLinux {
LOCALE_ARCHIVE_2_21 = "${oldpkgs.glibcLocales}/lib/locale/locale-archive"; LOCALE_ARCHIVE_2_21 = "${oldpkgs.glibcLocales}/lib/locale/locale-archive";
LOCALE_ARCHIVE_2_27 = "${pkgs.glibcLocales}/lib/locale/locale-archive"; LOCALE_ARCHIVE_2_27 = "${pkgs.glibcLocales}/lib/locale/locale-archive";
}); });
@ -83,7 +83,7 @@ let
pkg-config pkg-config
git git
] ]
++ stdenv.lib.optional stdenv.isDarwin pkgs.darwin.Security; ++ lib.optional stdenv.isDarwin pkgs.darwin.Security;
postHook = '' postHook = ''
checkPhase() { checkPhase() {
@ -99,7 +99,7 @@ let
passthru.phpEnv = phpEnv; passthru.phpEnv = phpEnv;
passthru.mozilla-rust-overlay = mozilla-rust-overlay; passthru.mozilla-rust-overlay = mozilla-rust-overlay;
} }
// stdenv.lib.optionalAttrs stdenv.isLinux { // lib.optionalAttrs stdenv.isLinux {
LOCALE_ARCHIVE_2_21 = "${oldpkgs.glibcLocales}/lib/locale/locale-archive"; LOCALE_ARCHIVE_2_21 = "${oldpkgs.glibcLocales}/lib/locale/locale-archive";
LOCALE_ARCHIVE_2_27 = "${pkgs.glibcLocales}/lib/locale/locale-archive"; LOCALE_ARCHIVE_2_27 = "${pkgs.glibcLocales}/lib/locale/locale-archive";
}); });