aboutsummaryrefslogtreecommitdiff
path: root/pkgs/development/compilers/purescript/psc-package
diff options
context:
space:
mode:
authorLily Ballard <lilyball@twitch.tv>2020-03-19 14:32:57 -0700
committerLily Ballard <lilyball@twitch.tv>2020-03-19 15:00:36 -0700
commit4ebc22781d41cd8d3d732da9c5c7090a0edfc3a4 (patch)
tree5bb58d00dae3e1009ebc0f2efe92157e3eecc84a /pkgs/development/compilers/purescript/psc-package
parentc8edc08dc477ce2de29a95e77444bb84928a2e57 (diff)
psc-package: Stop using haskellPackages to build
Switch to the approach taken by https://github.com/justinwoo/easy-purescript-nix/blob/master/psc-package-simple.nix This downloads a prebuilt release and patches the linker paths. It reduces the number of supported platforms, but ensures we're using the official supported psc-package compiler. The `haskellPackages` approach wasn't supported and was leading to version conflicts with dependencies.
Diffstat (limited to 'pkgs/development/compilers/purescript/psc-package')
-rw-r--r--pkgs/development/compilers/purescript/psc-package/default.nix70
1 files changed, 52 insertions, 18 deletions
diff --git a/pkgs/development/compilers/purescript/psc-package/default.nix b/pkgs/development/compilers/purescript/psc-package/default.nix
index 908a8e943e78..0bebd5d2f50d 100644
--- a/pkgs/development/compilers/purescript/psc-package/default.nix
+++ b/pkgs/development/compilers/purescript/psc-package/default.nix
@@ -1,27 +1,61 @@
-{ haskellPackages, mkDerivation, fetchFromGitHub, lib }:
+# Based on https://github.com/justinwoo/easy-purescript-nix/blob/master/psc-package-simple.nix
+{ stdenv, lib, fetchurl, gmp, zlib, libiconv, darwin, installShellFiles }:
-with lib;
+let
+ dynamic-linker = stdenv.cc.bintools.dynamicLinker;
+
+in
+stdenv.mkDerivation rec {
+ pname = "psc-package-simple";
-mkDerivation rec {
- pname = "psc-package";
version = "0.6.2";
- src = fetchFromGitHub {
- owner = "purescript";
- repo = pname;
- rev = "v${version}";
- sha256 = "0536mijma61khldnpbdviq2vvpfzzz7w8bxr59mvr19i10njdq0y";
+ src = if stdenv.isDarwin
+ then fetchurl {
+ url = "https://github.com/purescript/psc-package/releases/download/v0.6.2/macos.tar.gz";
+ sha256 = "17dh3bc5b6ahfyx0pi6n9qnrhsyi83qdynnca6k1kamxwjimpcq1";
+ }
+ else fetchurl {
+ url = "https://github.com/purescript/psc-package/releases/download/v0.6.2/linux64.tar.gz";
+ sha256 = "1zvay9q3xj6yd76w6qyb9la4jaj9zvpf4dp78xcznfqbnbhm1a54";
};
- isLibrary = false;
- isExecutable = true;
+ buildInputs = [ gmp zlib ];
+ nativeBuildInputs = [ installShellFiles ];
+
+ libPath = lib.makeLibraryPath buildInputs;
+
+ dontStrip = true;
+
+ installPhase = ''
+ mkdir -p $out/bin
- executableHaskellDepends = with haskellPackages; [
- aeson aeson-pretty either errors optparse-applicative
- system-filepath turtle
- ];
+ PSC_PACKAGE=$out/bin/psc-package
- description = "A package manager for PureScript based on package sets";
- license = licenses.bsd3;
- maintainers = with lib.maintainers; [ Profpatsch ];
+ install -D -m555 -T psc-package $PSC_PACKAGE
+ chmod u+w $PSC_PACKAGE
+ '' + lib.optionalString stdenv.isDarwin ''
+ install_name_tool \
+ -change /usr/lib/libSystem.B.dylib ${darwin.Libsystem}/lib/libSystem.B.dylib \
+ -change /usr/lib/libiconv.2.dylib ${libiconv}/libiconv.2.dylib \
+ $PSC_PACKAGE
+ '' + lib.optionalString (!stdenv.isDarwin) ''
+ patchelf --interpreter ${dynamic-linker} --set-rpath ${libPath} $PSC_PACKAGE
+ '' + ''
+ chmod u-w $PSC_PACKAGE
+
+ $PSC_PACKAGE --bash-completion-script $PSC_PACKAGE > psc-package.bash
+ $PSC_PACKAGE --fish-completion-script $PSC_PACKAGE > psc-package.fish
+ $PSC_PACKAGE --zsh-completion-script $PSC_PACKAGE > _psc-package
+ installShellCompletion \
+ psc-package.{bash,fish} \
+ --zsh _psc-package
+ '';
+
+ meta = with lib; {
+ description = "A package manager for PureScript based on package sets";
+ license = licenses.bsd3;
+ maintainers = with maintainers; [ Profpatsch ];
+ platforms = [ "x86_64-darwin" "x86_64-linux" ];
+ };
}