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