2023-04-12 12:48:02 +00:00
|
|
|
{ callPackage, lib, stdenv, chicken, makeWrapper }:
|
2020-04-24 23:36:52 +00:00
|
|
|
{ name, src
|
|
|
|
, buildInputs ? []
|
|
|
|
, chickenInstallFlags ? []
|
|
|
|
, cscOptions ? []
|
|
|
|
, ...} @ args:
|
|
|
|
|
|
|
|
let
|
2023-04-12 12:48:02 +00:00
|
|
|
overrides = callPackage ./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
|
2023-04-12 12:48:02 +00:00
|
|
|
lib.id;
|
2020-04-24 23:36:52 +00:00
|
|
|
in
|
2023-04-12 12:48:02 +00:00
|
|
|
(stdenv.mkDerivation ({
|
2020-04-24 23:36:52 +00:00
|
|
|
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
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
chicken-install -cached -no-install ${lib.escapeShellArgs chickenInstallFlags}
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
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}
|
2023-05-24 13:37:59 +00:00
|
|
|
chicken-install -cached ${lib.escapeShellArgs chickenInstallFlags}
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
for f in $out/bin/*
|
|
|
|
do
|
|
|
|
wrapProgram $f \
|
2023-05-24 13:37:59 +00:00
|
|
|
--prefix CHICKEN_REPOSITORY_PATH : "$out/lib/chicken/${toString chicken.binaryVersion}:$CHICKEN_REPOSITORY_PATH" \
|
|
|
|
--prefix CHICKEN_INCLUDE_PATH : "$CHICKEN_INCLUDE_PATH:$out/share" \
|
2020-04-24 23:36:52 +00:00
|
|
|
--prefix PATH : "$out/bin:${chicken}/bin:$CHICKEN_REPOSITORY_PATH"
|
|
|
|
done
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
2022-11-21 17:40:18 +00:00
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
dontConfigure = true;
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
meta = {
|
|
|
|
inherit (chicken.meta) platforms;
|
|
|
|
} // args.meta or {};
|
2023-04-12 12:48:02 +00:00
|
|
|
} // builtins.removeAttrs args ["name" "buildInputs" "meta"]) ).overrideAttrs override
|