2014-10-09 20:49:15 +02:00
|
|
|
{ stdenv, fetchegg, chicken, makeWrapper }:
|
|
|
|
{ name, src
|
|
|
|
, buildInputs ? []
|
|
|
|
, chickenInstallFlags ? []
|
|
|
|
, cscOptions ? []
|
|
|
|
, ...} @ args:
|
|
|
|
|
|
|
|
let
|
|
|
|
libPath = "${chicken}/var/lib/chicken/${toString chicken.binaryVersion}/";
|
2014-10-09 22:01:21 +02:00
|
|
|
overrides = import ./overrides.nix;
|
2014-10-09 21:59:17 +02:00
|
|
|
lib = stdenv.lib;
|
|
|
|
baseName = (builtins.parseDrvName name).name;
|
2014-10-09 22:01:21 +02:00
|
|
|
override = if builtins.hasAttr baseName overrides
|
2014-10-09 21:59:17 +02:00
|
|
|
then
|
2014-10-09 22:01:21 +02:00
|
|
|
builtins.getAttr baseName overrides
|
2014-10-09 21:59:17 +02:00
|
|
|
else
|
|
|
|
{};
|
2014-10-09 20:49:15 +02:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation ({
|
|
|
|
name = "chicken-${name}";
|
|
|
|
propagatedBuildInputs = buildInputs ++ [ chicken ];
|
|
|
|
propagatedUserEnvPkgs = buildInputs ++ [ chicken ];
|
|
|
|
buildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
CSC_OPTIONS = stdenv.lib.concatStringsSep " " cscOptions;
|
|
|
|
|
|
|
|
CHICKEN_REPOSITORY = libPath;
|
|
|
|
CHICKEN_INSTALL_PREFIX = "$out";
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
chicken-install -p $out ${stdenv.lib.concatStringsSep " " chickenInstallFlags}
|
|
|
|
|
|
|
|
for f in $out/bin/*
|
|
|
|
do
|
|
|
|
wrapProgram $f \
|
|
|
|
--set CHICKEN_REPOSITORY $CHICKEN_REPOSITORY \
|
|
|
|
--prefix CHICKEN_REPOSITORY_EXTRA : "$out/lib/chicken/${toString chicken.binaryVersion}/:$CHICKEN_REPOSITORY_EXTRA" \
|
|
|
|
--prefix CHICKEN_INCLUDE_PATH \; \"$CHICKEN_INCLUDE_PATH\;$out/share/\" \
|
2014-10-09 22:14:38 +02:00
|
|
|
--prefix PATH : "$out/bin:${chicken}/bin:$CHICKEN_REPOSITORY_EXTRA:$CHICKEN_REPOSITORY"
|
2014-10-09 20:49:15 +02:00
|
|
|
done
|
2014-10-15 12:07:31 +02:00
|
|
|
|
|
|
|
runHook postInstall
|
2014-10-09 20:49:15 +02:00
|
|
|
'';
|
2014-10-09 22:01:21 +02:00
|
|
|
} // (builtins.removeAttrs args ["name" "buildInputs"]) // override)
|