diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2017-11-06 18:18:59 +0000 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2018-02-07 19:25:50 +0000 |
commit | 947e7d80b41d9dea1739c23bf512f26d1c30703b (patch) | |
tree | 5f78026b58db3846acdec430863bf9a62fa9280a /pkgs/development/idris-modules/with-packages.nix | |
parent | 8d55538f973813c8db45e9434bc7f742290a1fd0 (diff) |
Refactor Idris packaging infrastructure
The main two changes are 1. Completely rewrite how with-packages works to remove use of envHooks 2. The package description is now an idris specific set rather than being a subset of the arguments to mkDerivation. This mirrors the way Haskell packages are treated.
Diffstat (limited to 'pkgs/development/idris-modules/with-packages.nix')
-rw-r--r-- | pkgs/development/idris-modules/with-packages.nix | 48 |
1 files changed, 11 insertions, 37 deletions
diff --git a/pkgs/development/idris-modules/with-packages.nix b/pkgs/development/idris-modules/with-packages.nix index d4638670f699d..1631555eee4a1 100644 --- a/pkgs/development/idris-modules/with-packages.nix +++ b/pkgs/development/idris-modules/with-packages.nix @@ -1,46 +1,20 @@ # Build a version of idris with a set of packages visible # packages: The packages visible to idris -{ stdenv, idris }: packages: stdenv.mkDerivation { - inherit (idris) name; +{ stdenv, idris, symlinkJoin, makeWrapper }: packages: - buildInputs = packages; +let paths = stdenv.lib.closePropagation packages; +in +symlinkJoin { - preHook = '' - mkdir -p $out/lib/${idris.name} + name = idris.name + "-with-packages"; - installIdrisLib () { - if [ -d $1/lib/${idris.name} ]; then - ln -fsv $1/lib/${idris.name}/* $out/lib/${idris.name} - fi - } + paths = paths ++ [idris] ; - envHostTargetHooks+=(installIdrisLib) - ''; + buildInputs = [ makeWrapper ]; - unpackPhase = '' - cat >idris.c <<EOF - #include <stdlib.h> - #include <unistd.h> - #include <stdio.h> + postBuild = '' + wrapProgram $out/bin/idris \ + --set IDRIS_LIBRARY_PATH $out/libs + ''; - int main (int argc, char ** argv) { - /* idris currently only supports a single library path, so respect it if the user set it */ - setenv("IDRIS_LIBRARY_PATH", "$out/lib/${idris.name}", 0); - execv("${idris}/bin/idris", argv); - perror("executing ${idris}/bin/idris"); - return 127; - } - EOF - ''; - - buildPhase = '' - $CC -O3 -o idris idris.c - ''; - - installPhase = '' - mkdir -p $out/bin - mv idris $out/bin - ''; - - stripAllList = [ "bin" ]; } |