forked from justinwoo/easy-purescript-nix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspago.nix
47 lines (35 loc) · 1.15 KB
/
spago.nix
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
{ pkgs ? import <nixpkgs> {} }:
let
patchelf = libPath: if pkgs.stdenv.isDarwin
then ""
else ''
chmod u+w $SPAGO
patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" --set-rpath ${libPath} $SPAGO
chmod u-w $SPAGO
'';
in
pkgs.stdenv.mkDerivation rec {
pname = "spago";
version = "0.20.8";
src = if pkgs.stdenv.isDarwin
then pkgs.fetchurl {
url = "https://github.com/purescript/spago/releases/download/${version}/macOS.tar.gz";
sha256 = "10csxf27af303wkg216mz9x5wr5yylbwzk8lsg9f19hnav2x4c07";
}
else pkgs.fetchurl {
url = "https://github.com/purescript/spago/releases/download/${version}/Linux.tar.gz";
sha256 = "1ihz44y6izg3nm391ms0cabv7i2g4n9ncvql4z8xpkg79r7s0vhr";
};
buildInputs = [ pkgs.gmp pkgs.zlib pkgs.ncurses5 pkgs.stdenv.cc.cc.lib ];
libPath = pkgs.lib.makeLibraryPath buildInputs;
dontStrip = true;
unpackPhase = ''
mkdir -p $out/bin
tar xf $src -C $out/bin
SPAGO=$out/bin/spago
${patchelf libPath}
mkdir -p $out/etc/bash_completion.d/
$SPAGO --bash-completion-script $SPAGO > $out/etc/bash_completion.d/spago-completion.bash
'';
dontInstall = true;
}