aboutsummaryrefslogtreecommitdiff
path: root/nix/purescript.nix
blob: 5b757b4682adf140392ca67b652c307b5a5d57b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{ stdenv, fetchurl, makeWrapper, patchelf, gmpxx, ncurses5, zlib }:

with stdenv; with lib;

mkDerivation rec {
  name = "purescript-binary-${version}";
  version = "0.12.0";
  platform = {
    "x86_64-linux" = "linux64";
  }.${hostPlatform.system};
  src = fetchurl {
    url =
      "https://github.com/"
      + "purescript/purescript/releases/download/"
      + "v${version}/${platform}.tar.gz";
    sha256 = {
      "x86_64-linux" = "1wf7n5y8qsa0s2p0nb5q81ck6ajfyp9ijr72bf6j6bhc6pcpgmyc";
    }.${hostPlatform.system};
    name = "purescript.tar.gz";
  };

  buildInputs = [ makeWrapper ];
  unpackCmd = "tar -xzf $curSrc";

  installPhase = ''
    mkdir -p $out/bin $out/lib
    cp purs $out/bin/
    runHook postInstall
  '';

  postInstall = let
    libs = makeLibraryPath [ cc.cc gmpxx ncurses5 zlib ];
  in ''
    interpreter="$(cat $NIX_CC/nix-support/dynamic-linker)"
    ${patchelf}/bin/patchelf \
      --set-interpreter $interpreter \
      $out/bin/purs
    wrapProgram $out/bin/purs \
      --prefix LD_LIBRARY_PATH : ${libs}
  '';

  meta = {
    description = "A small strongly typed programming language with expressive
    types that compiles to JavaScript, written in and inspired by Haskell.";
    homepage = http://www.purescript.org/;
    license = licenses.bsd3;
    platforms = [ "x86_64-linux" ];
  };
}