Clean up function interface

This commit is contained in:
Sander van der Burg 2018-06-24 22:27:59 +02:00
parent 8453940d79
commit f0aa6db6b6

View file

@ -49,7 +49,21 @@ rec {
''; '';
}; };
buildPackage = { name, src, packages ? {}, devPackages ? {}, symlinkDependencies ? false, executable ? false, removeComposerArtifacts ? false, postInstall ? "", noDev ? false, ...}@args: buildPackage =
{ name
, src
, packages ? {}
, devPackages ? {}
, buildInputs ? []
, symlinkDependencies ? false
, executable ? false
, removeComposerArtifacts ? false
, postInstall ? ""
, noDev ? false
, unpackPhase ? "true"
, buildPhase ? "true"
, ...}@args:
let let
reconstructInstalled = writeTextFile { reconstructInstalled = writeTextFile {
name = "reconstructinstalled.php"; name = "reconstructinstalled.php";
@ -149,11 +163,16 @@ rec {
} }
''} ''}
'') (builtins.attrNames dependencies); '') (builtins.attrNames dependencies);
extraArgs = removeAttrs args [ "name" "packages" "devPackages" "buildInputs" ];
in in
stdenv.lib.makeOverridable stdenv.mkDerivation (builtins.removeAttrs args [ "packages" "devPackages" ] // { stdenv.lib.makeOverridable stdenv.mkDerivation ({
name = "composer-${args.name}"; name = "composer-${name}";
buildInputs = [ php composer ] ++ args.buildInputs or []; buildInputs = [ php composer ] ++ buildInputs;
buildCommand = ''
inherit unpackPhase buildPhase;
installPhase = ''
${if executable then '' ${if executable then ''
mkdir -p $out/share/php mkdir -p $out/share/php
cp -av $src $out/share/php/$name cp -av $src $out/share/php/$name
@ -242,5 +261,5 @@ rec {
# Execute post install hook # Execute post install hook
runHook postInstall runHook postInstall
''; '';
}); } // extraArgs);
} }