1{ lib, stdenv, fetchurl, makeWrapper
2, haskellPackages, haskell
3, which, swiProlog, rlwrap, tk
4, curl, git, unzip, gnutar, coreutils, sqlite }:
5
6let
7 pname = "pakcs";
8 version = "3.6.0";
9
10 # Don't switch to "Current release" without a reason, because its
11 # source updates without version bump. Prefer last from "Older releases" instead.
12 src = fetchurl {
13 url = "https://www.informatik.uni-kiel.de/~pakcs/download/pakcs-${version}-src.tar.gz";
14 hash = "sha256-1r6jEY3eEGESKcAepiziVbxpIvQLtCS6l0trBU3SGGo=";
15 };
16
17 curry-frontend = (haskellPackages.override {
18 overrides = self: super: {
19 curry-frontend = haskell.lib.compose.overrideCabal (drv: {
20 inherit src;
21 postUnpack = "sourceRoot+=/frontend";
22 }) (super.callPackage ./curry-frontend.nix { });
23 };
24 }).curry-frontend;
25
26in stdenv.mkDerivation {
27 inherit pname version src;
28
29 buildInputs = [ swiProlog ];
30 nativeBuildInputs = [ which makeWrapper ];
31
32 makeFlags = [
33 "CURRYFRONTEND=${curry-frontend}/bin/curry-frontend"
34 "DISTPKGINSTALL=yes"
35 # Not needed, just to make script pass
36 "CURRYTOOLSDIR=0"
37 "CURRYLIBSDIR=0"
38 ];
39
40 preConfigure = ''
41 for file in examples/test.sh \
42 currytools/optimize/Makefile \
43 testsuite/test.sh \
44 scripts/cleancurry.sh \
45 scripts/compile-all-libs.sh; do
46 substituteInPlace $file --replace "/bin/rm" "rm"
47 done
48 '' ;
49
50 preBuild = ''
51 mkdir -p $out/pakcs
52 cp -r * $out/pakcs
53 cd $out/pakcs
54 '';
55
56 installPhase = ''
57 runHook preInstall
58
59 ln -s $out/pakcs/bin $out
60
61 mkdir -p $out/share/emacs/site-lisp
62 ln -s $out/pakcs/tools/emacs $out/share/emacs/site-lisp/curry-pakcs
63
64 wrapProgram $out/pakcs/bin/pakcs \
65 --prefix PATH ":" "${rlwrap}/bin" \
66 --prefix PATH ":" "${tk}/bin"
67
68 # List of dependencies from currytools/cpm/src/CPM/Main.curry
69 wrapProgram $out/pakcs/bin/cypm \
70 --prefix PATH ":" "${lib.makeBinPath [ curl git unzip gnutar coreutils sqlite ]}"
71
72 runHook postInstall
73 '';
74
75 meta = with lib; {
76 homepage = "http://www.informatik.uni-kiel.de/~pakcs/";
77 description = "An implementation of the multi-paradigm declarative language Curry";
78 license = licenses.bsd3;
79
80 longDescription = ''
81 PAKCS is an implementation of the multi-paradigm declarative language
82 Curry jointly developed by the Portland State University, the Aachen
83 University of Technology, and the University of Kiel. Although this is
84 not a highly optimized implementation but based on a high-level
85 compilation of Curry programs into Prolog programs, it is not a toy
86 implementation but has been used for a variety of applications (e.g.,
87 graphical programming environments, an object-oriented front-end for
88 Curry, partial evaluators, database applications, HTML programming
89 with dynamic web pages, prototyping embedded systems).
90 '';
91
92 maintainers = with maintainers; [ t4ccer ];
93 platforms = platforms.linux;
94 };
95}