-
Notifications
You must be signed in to change notification settings - Fork 57
/
spago.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
{ 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.21.0";
src = if pkgs.stdenv.isDarwin
then pkgs.fetchurl {
url = "https://github.com/purescript/spago/releases/download/${version}/macOS.tar.gz";
sha256 = "19c0kdg7gk1c7v00lnkcsxidffab84d50d6l6vgrjy4i86ilhzd5";
}
else pkgs.fetchurl {
url = "https://github.com/purescript/spago/releases/download/${version}/Linux.tar.gz";
sha256 = "1klczy04vwn5b39cnxflcqzap0d5kysp4dsw73i95xm5m7s37049";
};
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;
}