-
Notifications
You must be signed in to change notification settings - Fork 56
/
psc-package-simple.nix
48 lines (37 loc) · 1.44 KB
/
psc-package-simple.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
48
{ pkgs ? import <nixpkgs> {} }:
let
dynamic-linker = pkgs.stdenv.cc.bintools.dynamicLinker;
in
pkgs.stdenv.mkDerivation rec {
pname = "psc-package-simple";
version = "0.6.2";
src = if pkgs.stdenv.isDarwin
then pkgs.fetchurl {
url = "https://github.com/purescript/psc-package/releases/download/v0.6.2/macos.tar.gz";
sha256 = "17dh3bc5b6ahfyx0pi6n9qnrhsyi83qdynnca6k1kamxwjimpcq1";
}
else pkgs.fetchurl {
url = "https://github.com/purescript/psc-package/releases/download/v0.6.2/linux64.tar.gz";
sha256 = "1zvay9q3xj6yd76w6qyb9la4jaj9zvpf4dp78xcznfqbnbhm1a54";
};
buildInputs = [ pkgs.gmp pkgs.zlib ];
libPath = pkgs.lib.makeLibraryPath buildInputs;
dontStrip = true;
installPhase = ''
mkdir -p $out/bin
PSC_PACKAGE=$out/bin/psc-package
install -D -m555 -T psc-package $PSC_PACKAGE
chmod u+w $PSC_PACKAGE
'' + pkgs.lib.optionalString pkgs.stdenv.isDarwin ''
install_name_tool \
-change /usr/lib/libSystem.B.dylib ${pkgs.darwin.Libsystem}/lib/libSystem.B.dylib \
-change /usr/lib/libiconv.2.dylib ${pkgs.libiconv}/libiconv.2.dylib \
$PSC_PACKAGE
'' + pkgs.lib.optionalString (!pkgs.stdenv.isDarwin) ''
patchelf --interpreter ${dynamic-linker} --set-rpath ${libPath} $PSC_PACKAGE
'' + ''
chmod u-w $PSC_PACKAGE
mkdir -p $out/etc/bash_completion.d/
$PSC_PACKAGE --bash-completion-script $PSC_PACKAGE > $out/etc/bash_completion.d/psc-package-completion.bash
'';
}