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