summary refs log tree commit diff
path: root/pkgs/development/idris-modules
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2015-11-27 07:56:11 -0500
committerShea Levy <shea@shealevy.com>2015-11-27 07:56:11 -0500
commit34e8eea942e02a5562c2391e62fd1e5cfc154dda (patch)
treea1054c7b23e1ba4ccd164b85f6c4195cd6696314 /pkgs/development/idris-modules
parentdc3ec30765c0566d11d22ab60520619796d4e5e3 (diff)
downloadnixpkgs-34e8eea942e02a5562c2391e62fd1e5cfc154dda.tar
nixpkgs-34e8eea942e02a5562c2391e62fd1e5cfc154dda.tar.gz
nixpkgs-34e8eea942e02a5562c2391e62fd1e5cfc154dda.tar.bz2
nixpkgs-34e8eea942e02a5562c2391e62fd1e5cfc154dda.tar.lz
nixpkgs-34e8eea942e02a5562c2391e62fd1e5cfc154dda.tar.xz
nixpkgs-34e8eea942e02a5562c2391e62fd1e5cfc154dda.tar.zst
nixpkgs-34e8eea942e02a5562c2391e62fd1e5cfc154dda.zip
Add with-packages wrapper for idris
Diffstat (limited to 'pkgs/development/idris-modules')
-rw-r--r--pkgs/development/idris-modules/with-packages-wrapper.nix38
1 files changed, 38 insertions, 0 deletions
diff --git a/pkgs/development/idris-modules/with-packages-wrapper.nix b/pkgs/development/idris-modules/with-packages-wrapper.nix
new file mode 100644
index 00000000000..e55fd2c3324
--- /dev/null
+++ b/pkgs/development/idris-modules/with-packages-wrapper.nix
@@ -0,0 +1,38 @@
+{ stdenv, idris, packages }: stdenv.mkDerivation {
+  inherit (idris) name;
+
+  inherit packages;
+
+  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/lib/${idris.name}
+    for package in $packages
+    do
+      ln -sv $package/lib/${idris.name}/* $out/lib/${idris.name}
+    done
+
+    mkdir -p $out/bin
+    mv idris $out/bin
+  '';
+
+  stripAllList = [ "bin" ];
+}