2021-01-22 11:25:31 +00:00
|
|
|
{ lib, stdenv, chicken, makeWrapper }:
|
2014-10-09 19:49:15 +01:00
|
|
|
{ name, src
|
|
|
|
, buildInputs ? []
|
|
|
|
, chickenInstallFlags ? []
|
|
|
|
, cscOptions ? []
|
|
|
|
, ...} @ args:
|
|
|
|
|
|
|
|
let
|
|
|
|
libPath = "${chicken}/var/lib/chicken/${toString chicken.binaryVersion}/";
|
2014-10-09 21:01:21 +01:00
|
|
|
overrides = import ./overrides.nix;
|
2021-01-22 11:25:31 +00:00
|
|
|
baseName = lib.getName name;
|
2014-10-09 21:01:21 +01:00
|
|
|
override = if builtins.hasAttr baseName overrides
|
2014-10-09 20:59:17 +01:00
|
|
|
then
|
2014-10-09 21:01:21 +01:00
|
|
|
builtins.getAttr baseName overrides
|
2014-10-09 20:59:17 +01:00
|
|
|
else
|
|
|
|
{};
|
2014-10-09 19:49:15 +01:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation ({
|
|
|
|
name = "chicken-${name}";
|
2018-11-14 03:17:50 +00:00
|
|
|
propagatedBuildInputs = buildInputs;
|
2021-02-07 09:17:39 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
buildInputs = [ chicken ];
|
2014-10-09 19:49:15 +01:00
|
|
|
|
2021-01-22 11:25:31 +00:00
|
|
|
CSC_OPTIONS = lib.concatStringsSep " " cscOptions;
|
2014-10-09 19:49:15 +01:00
|
|
|
|
|
|
|
CHICKEN_REPOSITORY = libPath;
|
|
|
|
CHICKEN_INSTALL_PREFIX = "$out";
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
2021-01-22 11:25:31 +00:00
|
|
|
chicken-install -p $out ${lib.concatStringsSep " " chickenInstallFlags}
|
2014-10-09 19:49:15 +01:00
|
|
|
|
|
|
|
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" \
|
2017-11-19 23:50:49 +00:00
|
|
|
--prefix CHICKEN_INCLUDE_PATH \; "$CHICKEN_INCLUDE_PATH;$out/share/" \
|
2014-10-09 21:14:38 +01:00
|
|
|
--prefix PATH : "$out/bin:${chicken}/bin:$CHICKEN_REPOSITORY_EXTRA:$CHICKEN_REPOSITORY"
|
2014-10-09 19:49:15 +01:00
|
|
|
done
|
2014-10-15 11:07:31 +01:00
|
|
|
|
|
|
|
runHook postInstall
|
2014-10-09 19:49:15 +01:00
|
|
|
'';
|
2014-10-09 21:01:21 +01:00
|
|
|
} // (builtins.removeAttrs args ["name" "buildInputs"]) // override)
|