Merge pull request #300012 from mattpolzin/build-idris-path

idris2Packages.buildIdris: better nix-shell support via shellHook
This commit is contained in:
Fabián Heredia Montiel 2024-03-29 16:26:28 -06:00 committed by GitHub
commit 57936619f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -32,7 +32,8 @@ let
"idrisLibraries"
];
sharedAttrs = drvAttrs // {
derivation = stdenv.mkDerivation (finalAttrs:
drvAttrs // {
pname = ipkgName;
inherit version;
src = src;
@ -50,10 +51,15 @@ let
passthru = {
inherit propagatedIdrisLibraries;
};
};
shellHook = ''
export IDRIS2_PACKAGE_PATH="${finalAttrs.IDRIS2_PACKAGE_PATH}"
'';
}
);
in {
executable = stdenv.mkDerivation (sharedAttrs // {
executable = derivation.overrideAttrs {
installPhase = ''
runHook preInstall
mkdir -p $out/bin
@ -76,11 +82,11 @@ in {
fi
runHook postInstall
'';
});
};
library = { withSource ? false }:
let installCmd = if withSource then "--install-with-src" else "--install";
in stdenv.mkDerivation (sharedAttrs // {
in derivation.overrideAttrs {
installPhase = ''
runHook preInstall
mkdir -p $out/${libSuffix}
@ -88,5 +94,5 @@ in {
idris2 ${installCmd} ${ipkgFileName}
runHook postInstall
'';
});
};
}