2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, chicken, makeWrapper }:
|
2020-04-24 23:36:52 +00:00
|
|
|
{ name, src
|
|
|
|
, buildInputs ? []
|
|
|
|
, chickenInstallFlags ? []
|
|
|
|
, cscOptions ? []
|
|
|
|
, ...} @ args:
|
|
|
|
|
|
|
|
let
|
|
|
|
overrides = import ./overrides.nix;
|
2021-02-05 17:12:51 +00:00
|
|
|
baseName = lib.getName name;
|
2020-04-24 23:36:52 +00:00
|
|
|
override = if builtins.hasAttr baseName overrides
|
|
|
|
then
|
|
|
|
builtins.getAttr baseName overrides
|
|
|
|
else
|
|
|
|
{};
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation ({
|
|
|
|
name = "chicken-${name}";
|
|
|
|
propagatedBuildInputs = buildInputs;
|
2021-03-09 03:18:52 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
buildInputs = [ chicken ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
CSC_OPTIONS = lib.concatStringsSep " " cscOptions;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
export CHICKEN_INSTALL_PREFIX=$out
|
|
|
|
export CHICKEN_INSTALL_REPOSITORY=$out/lib/chicken/${toString chicken.binaryVersion}
|
2021-02-05 17:12:51 +00:00
|
|
|
chicken-install ${lib.concatStringsSep " " chickenInstallFlags}
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
for f in $out/bin/*
|
|
|
|
do
|
|
|
|
wrapProgram $f \
|
|
|
|
--prefix CHICKEN_REPOSITORY_PATH : "$out/lib/chicken/${toString chicken.binaryVersion}:$CHICKEN_REPOSITORY_PATH" \
|
|
|
|
--prefix CHICKEN_INCLUDE_PATH : "$CHICKEN_INCLUDE_PATH:$out/share" \
|
|
|
|
--prefix PATH : "$out/bin:${chicken}/bin:$CHICKEN_REPOSITORY_PATH"
|
|
|
|
done
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
2022-11-21 17:40:18 +00:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
inherit (chicken.meta) platforms;
|
|
|
|
} // args.meta or {};
|
|
|
|
} // (builtins.removeAttrs args ["name" "buildInputs" "meta"]) // override)
|