diff options
author | Shea Levy <shea@shealevy.com> | 2015-11-27 09:55:22 -0500 |
---|---|---|
committer | Shea Levy <shea@shealevy.com> | 2015-11-27 09:55:22 -0500 |
commit | a5ca796f557f74e23328c8892447b0606d333f8d (patch) | |
tree | e9a673bb78c667ffe027cf6bad972bb82f656bcd /pkgs/development/idris-modules/with-packages.nix | |
parent | efbee054fd2dca2b14c729cf73aca7246c56d9f2 (diff) |
idris-modules: Read the filesystem to populate package list
Diffstat (limited to 'pkgs/development/idris-modules/with-packages.nix')
-rw-r--r-- | pkgs/development/idris-modules/with-packages.nix | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/pkgs/development/idris-modules/with-packages.nix b/pkgs/development/idris-modules/with-packages.nix new file mode 100644 index 0000000000000..f8abe09fe877c --- /dev/null +++ b/pkgs/development/idris-modules/with-packages.nix @@ -0,0 +1,44 @@ +{ stdenv, idris }: buildInputs: stdenv.mkDerivation { + inherit (idris) name; + + inherit buildInputs; + + preHook = '' + mkdir -p $out/lib/${idris.name} + + installIdrisLib () { + if [ -d $1/lib/${idris.name} ]; then + ln -sv $1/lib/${idris.name}/* $out/lib/${idris.name} + fi + } + + envHooks+=(installIdrisLib) + ''; + + unpackPhase = '' + cat >idris.c <<EOF + #include <stdlib.h> + #include <unistd.h> + #include <stdio.h> + + 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 = '' + gcc -O3 -o idris idris.c + ''; + + installPhase = '' + mkdir -p $out/bin + mv idris $out/bin + ''; + + stripAllList = [ "bin" ]; +} |