diff options
author | wchresta <34962284+wchresta@users.noreply.github.com> | 2020-08-16 23:41:02 -0400 |
---|---|---|
committer | wchresta <34962284+wchresta@users.noreply.github.com> | 2020-08-20 22:09:05 -0400 |
commit | 24d5c73aa81b95e5aedcb92bc93e0a865a84885e (patch) | |
tree | cc17e48e8ed6e570a557cd886a497f5bb7eb0c2a /pkgs/development/compilers/idris2 | |
parent | c057e8df8322e4e892464b79717ee765b6779a90 (diff) |
idris2: Enable --install, bugfixes
This removes the need of the bin/idris2_app folder and replaces it with proper links to the nix-storage folders. This allows the user to override IDRIS2_PREFIX which will allow them to use --install to install libraries. * Fix: idris2_app/ was exposed in bin/ * Remove native Idris2 wrapper that set LD_LIBRARY_PATH * Improve new Idris2 wrapper to set Idris2 paths to out folders
Diffstat (limited to 'pkgs/development/compilers/idris2')
-rw-r--r-- | pkgs/development/compilers/idris2/default.nix | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/pkgs/development/compilers/idris2/default.nix b/pkgs/development/compilers/idris2/default.nix index f0785aead8485..5bde4bbb720fb 100644 --- a/pkgs/development/compilers/idris2/default.nix +++ b/pkgs/development/compilers/idris2/default.nix @@ -4,7 +4,7 @@ # Uses scheme to bootstrap the build of idris2 stdenv.mkDerivation rec { - name = "idris2"; + pname = "idris2"; version = "0.2.1"; src = fetchFromGitHub { @@ -30,9 +30,42 @@ stdenv.mkDerivation rec { checkTarget = "bootstrap-test"; - # idris2 needs to find scheme at runtime to compile - postInstall = '' - wrapProgram "$out/bin/idris2" --set CHEZ "${chez}/bin/scheme" + # TODO: Move this into its own derivation, such that this can be changed + # without having to recompile idris2 every time. + postInstall = let + includedLibs = [ "base" "contrib" "network" "prelude" ]; + name = "${pname}-${version}"; + packagePaths = builtins.map (l: "$out/${name}/" + l) includedLibs; + additionalIdris2Paths = builtins.concatStringsSep ":" packagePaths; + in '' + # Remove existing idris2 wrapper that sets incorrect LD_LIBRARY_PATH + rm $out/bin/idris2 + # Move actual idris2 binary + mv $out/bin/idris2_app/idris2.so $out/bin/idris2 + + # After moving the binary, there is nothing left in idris2_app that isn't + # either contained in lib/ or is useless to us. + rm $out/bin/idris2_app/* + rmdir $out/bin/idris2_app + + # idris2 needs to find scheme at runtime to compile + # idris2 installs packages with --install into the path given by PREFIX. + # Since PREFIX is in nix-store, it is immutable so --install does not work. + # If the user redefines PREFIX to be able to install packages, idris2 will + # not find the libraries and packages since all paths are relative to + # PREFIX by default. + # We explicitly make all paths to point to nix-store, such that they are + # independent of what IDRIS2_PREFIX is. This allows the user to redefine + # IDRIS2_PREFIX and use --install as expected. + # TODO: Make support libraries their own derivation such that + # overriding LD_LIBRARY_PATH is unnecessary + # TODO: Maybe set IDRIS2_PREFIX to the users home directory + wrapProgram "$out/bin/idris2" \ + --set-default CHEZ "${chez}/bin/scheme" \ + --suffix IDRIS2_LIBS ':' "$out/${name}/lib" \ + --suffix IDRIS2_DATA ':' "$out/${name}/support" \ + --suffix IDRIS2_PATH ':' "${additionalIdris2Paths}" \ + --suffix LD_LIBRARY_PATH ':' "$out/${name}/lib" ''; meta = { |