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 = "2.2.1";
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 sha256 = "1jyg29j8r8pgcin7ixdya6c3zzfjdi66rghpwrfnkk133fz4iz7s";
15 };
16
17 curry-frontend = (haskellPackages.override {
18 overrides = self: super: {
19 curry-base = haskell.lib.compose.overrideCabal (drv: {
20 inherit src;
21 postUnpack = "sourceRoot+=/frontend/curry-base";
22 }) (super.callPackage ./curry-base.nix {});
23 curry-frontend = haskell.lib.compose.overrideCabal (drv: {
24 inherit src;
25 postUnpack = "sourceRoot+=/frontend/curry-frontend";
26 }) (super.callPackage ./curry-frontend.nix {});
27 };
28 }).curry-frontend;
29in stdenv.mkDerivation {
30 inherit pname version src;
31
32 buildInputs = [ swiProlog ];
33 nativeBuildInputs = [ which makeWrapper ];
34
35 makeFlags = [
36 "CURRYFRONTEND=${curry-frontend}/bin/curry-frontend"
37 "DISTPKGINSTALL=yes"
38 # Not needed, just to make script pass
39 "CURRYTOOLSDIR=0"
40 "CURRYLIBSDIR=0"
41 ];
42
43 preConfigure = ''
44 # Since we can't expand $out in `makeFlags`
45 #makeFlags="$makeFlags PAKCSINSTALLDIR=$out/pakcs"
46
47 for file in currytools/cpm/src/CPM/Repository.curry \
48 currytools/cpm/src/CPM/Repository/CacheDB.curry \
49 scripts/compile-all-libs.sh \
50 scripts/cleancurry.sh \
51 examples/test.sh testsuite/test.sh lib/test.sh; do
52 substituteInPlace $file --replace "/bin/rm" "rm"
53 done
54 '' ;
55
56 # cypm new: EXISTENCE ERROR: source_sink
57 # "/tmp/nix-build-pakcs-2.0.2.drv-0/pakcs-2.0.2/currytools/cpm/templates/LICENSE"
58 # does not exist
59 buildPhase = ''
60 mkdir -p $out/pakcs
61 cp -r * $out/pakcs
62 (cd $out/pakcs ; make -j$NIX_BUILD_CORES $makeFlags)
63 '';
64
65 installPhase = ''
66 ln -s $out/pakcs/bin $out
67
68 mkdir -p $out/share/emacs/site-lisp
69 ln -s $out/pakcs/tools/emacs $out/share/emacs/site-lisp/curry-pakcs
70
71 wrapProgram $out/pakcs/bin/pakcs \
72 --prefix PATH ":" "${rlwrap}/bin" \
73 --prefix PATH ":" "${tk}/bin"
74
75 # List of dependencies from currytools/cpm/src/CPM/Main.curry
76 wrapProgram $out/pakcs/bin/cypm \
77 --prefix PATH ":" "${lib.makeBinPath [ curl git unzip gnutar coreutils sqlite ]}"
78 '';
79
80 meta = with lib; {
81 homepage = "http://www.informatik.uni-kiel.de/~pakcs/";
82 description = "An implementation of the multi-paradigm declarative language Curry";
83 license = licenses.bsd3;
84
85 longDescription = ''
86 PAKCS is an implementation of the multi-paradigm declarative language
87 Curry jointly developed by the Portland State University, the Aachen
88 University of Technology, and the University of Kiel. Although this is
89 not a highly optimized implementation but based on a high-level
90 compilation of Curry programs into Prolog programs, it is not a toy
91 implementation but has been used for a variety of applications (e.g.,
92 graphical programming environments, an object-oriented front-end for
93 Curry, partial evaluators, database applications, HTML programming
94 with dynamic web pages, prototyping embedded systems).
95 '';
96
97 maintainers = with maintainers; [ ];
98 platforms = platforms.linux;
99 };
100}