nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchFromGitHub,
4 fetchpatch,
5 makeWrapper,
6 clang,
7 haskellPackages,
8}:
9
10haskellPackages.mkDerivation rec {
11 pname = "carp";
12 version = "0.5.5";
13
14 src = fetchFromGitHub {
15 owner = "carp-lang";
16 repo = "Carp";
17 rev = "v${version}";
18 sha256 = "sha256-B7SBzjegFzL2gGivIJE6BZcLD3f0Bsh8yndjScG2TZI=";
19 };
20
21 patches = [
22 # Compat with GHC 9.2 / Stackage LTS 20, can be dropped at the next release
23 # https://github.com/carp-lang/Carp/pull/1449
24 (fetchpatch {
25 name = "carp-lts-20.patch";
26 url = "https://github.com/carp-lang/Carp/commit/25f50c92a57cc91b6cb4ec48df658439f936b641.patch";
27 sha256 = "14yjv0hcvw1qyjmrhksrj6chac3n14d1f1gcaxldfa05llrbfqk0";
28 })
29 ];
30
31 # -Werror breaks build with GHC >= 9.0
32 # https://github.com/carp-lang/Carp/issues/1386
33 postPatch = ''
34 substituteInPlace CarpHask.cabal --replace "-Werror" ""
35 '';
36
37 buildTools = [ makeWrapper ];
38
39 executableHaskellDepends = with haskellPackages; [
40 HUnit
41 blaze-markup
42 blaze-html
43 split
44 ansi-terminal
45 cmark
46 edit-distance
47 hashable
48 open-browser
49 optparse-applicative
50 ];
51
52 isExecutable = true;
53
54 # The carp executable must know where to find its core libraries and other
55 # files. Set the environment variable CARP_DIR so that it points to the root
56 # of the Carp repo. See:
57 # https://github.com/carp-lang/Carp/blob/master/docs/Install.md#setting-the-carp_dir
58 #
59 # Also, clang must be available run-time because carp is compiled to C which
60 # is then compiled with clang.
61 postInstall = ''
62 wrapProgram $out/bin/carp \
63 --set CARP_DIR $src \
64 --prefix PATH : ${clang}/bin
65 wrapProgram $out/bin/carp-header-parse \
66 --set CARP_DIR $src \
67 --prefix PATH : ${clang}/bin
68 '';
69
70 description = "Statically typed lisp, without a GC, for real-time applications";
71 homepage = "https://github.com/carp-lang/Carp";
72 license = lib.licenses.asl20;
73 maintainers = with lib.maintainers; [ jluttine ];
74 # Not actively maintained at the moment
75 broken = true;
76
77 # Windows not (yet) supported.
78 platforms = with lib.platforms; unix ++ darwin;
79}