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
{ stdenv, writeTextFile, fetchurl, php, unzip }:
{ stdenv, lib, writeTextFile, fetchurl, php, unzip }:
let
composer = stdenv.mkDerivation {
@ -31,8 +31,8 @@ let
meta = {
description = "Dependency Manager for PHP";
#license = stdenv.licenses.mit;
maintainers = [ stdenv.lib.maintainers.sander ];
platforms = stdenv.lib.platforms.unix;
maintainers = [ lib.maintainers.sander ];
platforms = lib.platforms.unix;
};
};
@ -89,7 +89,7 @@ let
else
$allPackages = array();
${stdenv.lib.optionalString (!noDev) ''
${lib.optionalString (!noDev) ''
if(array_key_exists("packages-dev", $config))
$allPackages = array_merge($allPackages, $config["packages-dev"]);
''}
@ -140,7 +140,7 @@ let
};
bundleDependencies = dependencies:
stdenv.lib.concatMapStrings (dependencyName:
lib.concatMapStrings (dependencyName:
let
dependency = dependencies.${dependencyName};
in
@ -211,24 +211,24 @@ let
# Copy or symlink the provided dependencies
cd vendor
${bundleDependencies packages}
${stdenv.lib.optionalString (!noDev) (bundleDependencies devPackages)}
${lib.optionalString (!noDev) (bundleDependencies devPackages)}
cd ..
# Reconstruct autoload scripts
# 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.
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
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
${constructBin} composer.json
ln -s $(pwd)/vendor/bin $out/bin
''}
${stdenv.lib.optionalString (!symlinkDependencies) ''
${lib.optionalString (!symlinkDependencies) ''
# Patch the shebangs if possible
if [ -d $(pwd)/vendor/bin ]
then
@ -264,7 +264,7 @@ let
} // extraArgs);
in
{
composer = stdenv.lib.makeOverridable composer;
buildZipPackage = stdenv.lib.makeOverridable buildZipPackage;
buildPackage = stdenv.lib.makeOverridable buildPackage;
composer = lib.makeOverridable composer;
buildZipPackage = lib.makeOverridable buildZipPackage;
buildPackage = lib.makeOverridable buildPackage;
}

View file

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

View file

@ -17,7 +17,7 @@ let
oldpkgs = import oldpkgsSrc {};
inherit (pkgs) stdenv;
inherit (pkgs) stdenv lib;
phpEnv = stdenv.mkDerivation rec {
name = "gh-event-forwarder";
@ -43,7 +43,7 @@ let
pkg-config
openssl
]
++ stdenv.lib.optional stdenv.isDarwin pkgs.darwin.Security;
++ lib.optional stdenv.isDarwin pkgs.darwin.Security;
postHook = ''
checkPhase() (
@ -67,7 +67,7 @@ let
RUST_BACKTRACE = "1";
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_27 = "${pkgs.glibcLocales}/lib/locale/locale-archive";
});
@ -83,7 +83,7 @@ let
pkg-config
git
]
++ stdenv.lib.optional stdenv.isDarwin pkgs.darwin.Security;
++ lib.optional stdenv.isDarwin pkgs.darwin.Security;
postHook = ''
checkPhase() {
@ -99,7 +99,7 @@ let
passthru.phpEnv = phpEnv;
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_27 = "${pkgs.glibcLocales}/lib/locale/locale-archive";
});