summaryrefslogtreecommitdiffstats
path: root/pkgs/development/compilers/idris2
diff options
context:
space:
mode:
authorMathew Polzin <matt.polzin@gmail.com>2024-03-29 09:29:08 -0500
committerMathew Polzin <matt.polzin@gmail.com>2024-03-29 09:29:08 -0500
commit8273075e61866a83ac05085667df6074c8fc736f (patch)
tree51e99a80cd0e52fc3ccae2259b31657c56ab1b0d /pkgs/development/compilers/idris2
parent824952ff6b32b0019465b139b5c76d915ec074ea (diff)
idris2Packages.buildIdris: better nix-shell support via shellHook
Diffstat (limited to 'pkgs/development/compilers/idris2')
-rw-r--r--pkgs/development/compilers/idris2/build-idris.nix46
1 files changed, 26 insertions, 20 deletions
diff --git a/pkgs/development/compilers/idris2/build-idris.nix b/pkgs/development/compilers/idris2/build-idris.nix
index e66306c4344b..1df763e4c4fd 100644
--- a/pkgs/development/compilers/idris2/build-idris.nix
+++ b/pkgs/development/compilers/idris2/build-idris.nix
@@ -32,28 +32,34 @@ let
"idrisLibraries"
];
- sharedAttrs = drvAttrs // {
- pname = ipkgName;
- inherit version;
- src = src;
- nativeBuildInputs = [ idris2 makeWrapper ] ++ attrs.nativeBuildInputs or [];
- buildInputs = propagatedIdrisLibraries ++ attrs.buildInputs or [];
+ derivation = stdenv.mkDerivation (finalAttrs:
+ drvAttrs // {
+ pname = ipkgName;
+ inherit version;
+ src = src;
+ nativeBuildInputs = [ idris2 makeWrapper ] ++ attrs.nativeBuildInputs or [];
+ buildInputs = propagatedIdrisLibraries ++ attrs.buildInputs or [];
- IDRIS2_PACKAGE_PATH = libDirs;
+ IDRIS2_PACKAGE_PATH = libDirs;
- buildPhase = ''
- runHook preBuild
- idris2 --build ${ipkgFileName}
- runHook postBuild
- '';
+ buildPhase = ''
+ runHook preBuild
+ idris2 --build ${ipkgFileName}
+ runHook postBuild
+ '';
- passthru = {
- inherit propagatedIdrisLibraries;
- };
- };
+ 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
'';
- });
+ };
}