Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

psc-package: Stop using haskellPackages to build #82964

Merged
merged 1 commit into from Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
70 changes: 52 additions & 18 deletions 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" ];
Copy link
Member Author

@lilyball lilyball Mar 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/justinwoo/easy-purescript-nix/blob/master/psc-package-simple.nix did not contain a platforms declaration so I created this based on the releases. I'm not sure if there are any other platforms besides "x86_64-linux" that work with the linux64 binary download.

};
}
3 changes: 1 addition & 2 deletions pkgs/top-level/all-packages.nix
Expand Up @@ -8343,8 +8343,7 @@ in

purescript = callPackage ../development/compilers/purescript/purescript { };

psc-package = haskell.lib.justStaticExecutables
(haskellPackages.callPackage ../development/compilers/purescript/psc-package { });
psc-package = callPackage ../development/compilers/purescript/psc-package { };

purescript-psa = nodePackages.purescript-psa;

Expand Down