depot/third_party/nixpkgs/pkgs/development/compilers/chicken/4/eggDerivation.nix
Default email 01ed8ef136 Project import generated by Copybara.
GitOrigin-RevId: 20fc948445a6c22d4e8d5178e9a6bc6e1f5417c8
2022-11-21 19:40:18 +02:00

49 lines
1.4 KiB
Nix

{ lib, stdenv, chicken, makeWrapper }:
{ name, src
, buildInputs ? []
, chickenInstallFlags ? []
, cscOptions ? []
, ...} @ args:
let
libPath = "${chicken}/var/lib/chicken/${toString chicken.binaryVersion}/";
overrides = import ./overrides.nix;
baseName = lib.getName name;
override = if builtins.hasAttr baseName overrides
then
builtins.getAttr baseName overrides
else
{};
in
stdenv.mkDerivation ({
name = "chicken-${name}";
propagatedBuildInputs = buildInputs;
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ chicken ];
CSC_OPTIONS = lib.concatStringsSep " " cscOptions;
CHICKEN_REPOSITORY = libPath;
CHICKEN_INSTALL_PREFIX = "$out";
installPhase = ''
runHook preInstall
chicken-install -p $out ${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/" \
--prefix PATH : "$out/bin:${chicken}/bin:$CHICKEN_REPOSITORY_EXTRA:$CHICKEN_REPOSITORY"
done
runHook postInstall
'';
meta = {
inherit (chicken.meta) platforms;
} // args.meta or {};
} // (builtins.removeAttrs args ["name" "buildInputs" "meta"]) // override)