]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - pkgs/composer-env/default.nix
WIP upgrade
[perso/Immae/Config/Nix.git] / pkgs / composer-env / default.nix
index 416a61cab39567d15e433680325742a7409cd4b2..8631ca89093e9e5d6904915c58f1b88e447ae620 100644 (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 {
@@ -30,9 +30,9 @@ let
     '';
     meta = {
       description = "Dependency Manager for PHP";
-      #license = stdenv.licenses.mit;
-      maintainers = [ stdenv.lib.maintainers.sander ];
-      platforms = stdenv.lib.platforms.unix;
+      #license = lib.licenses.mit;
+      maintainers = [ lib.maintainers.sander ];
+      platforms = lib.platforms.unix;
     };
   };
 
@@ -91,7 +91,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"]);
                   ''}
@@ -142,7 +142,7 @@ let
       };
 
       bundleDependencies = dependencies:
-        stdenv.lib.concatMapStrings (dependencyName:
+        lib.concatMapStrings (dependencyName:
           let
             dependency = dependencies.${dependencyName};
           in
@@ -221,24 +221,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
@@ -274,7 +274,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;
 }