forked from carp-lang/Carp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
80 lines (73 loc) · 3.07 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{ nixpkgs ? import <nixpkgs> {}
, compiler ? "default"
, doBenchmark ? false
, profiling ? false
, doCheck ? true
}:
let
inherit (nixpkgs) pkgs;
optionals = nixpkgs.stdenv.lib.optionals;
linuxOnly = optionals nixpkgs.stdenv.isLinux;
f = { mkDerivation, stdenv
, ansi-terminal, open-browser, base, blaze-html, blaze-markup
, cmark, containers, directory, edit-distance, filepath, hashable
, haskeline, HUnit, mtl, optparse-applicative, parsec, process, split, text
, darwin, glfw3, SDL2, SDL2_image, SDL2_gfx, SDL2_mixer, SDL2_ttf
, ghc-prof-flamegraph, ormolu, hlint
, clang , makeWrapper
, libXext, libXcursor, libXinerama, libXi, libXrandr, libXScrnSaver, libXxf86vm, libpthreadstubs, libXdmcp, libGL
, cabal-install, gdb , flamegraph, linuxPackages, tinycc, zig
}:
mkDerivation {
pname = "CarpHask";
version = "dev";
src = ./.;
inherit doCheck doBenchmark;
isLibrary = false;
isExecutable = true;
enableSharedLibraries = false;
enableSharedExecutables = false;
enableLibraryProfiling = profiling;
enableExecutableProfiling = profiling;
libraryHaskellDepends = [
ansi-terminal open-browser base blaze-html blaze-markup cmark containers
directory edit-distance filepath haskeline mtl parsec process split
text hashable
] ++ optionals profiling [ ghc-prof-flamegraph ];
pkgconfigDepends =
[ glfw3 SDL2 SDL2_image SDL2_gfx SDL2_mixer SDL2_ttf ]
++ linuxOnly [ libXext libXcursor libXinerama libXi libXrandr libXScrnSaver libXxf86vm libpthreadstubs libXdmcp libGL];
executableHaskellDepends = [
base containers directory haskeline optparse-applicative parsec process
clang
];
executableToolDepends = optionals pkgs.lib.inNixShell (
[ cabal-install clang gdb ormolu hlint ]
++ optionals stdenv.isLinux [ flamegraph linuxPackages.perf tinycc zig ]
);
executableFrameworkDepends = with darwin.apple_sdk.frameworks; optionals stdenv.isDarwin [
Carbon Cocoa IOKit CoreFoundation CoreVideo IOKit ForceFeedback
];
buildDepends = [ makeWrapper ];
postPatch = ''
patchShebangs .
'';
postInstall = ''
wrapProgram $out/bin/carp --set CARP_DIR $src --prefix PATH : ${clang}/bin
wrapProgram $out/bin/carp-header-parse --set CARP_DIR $src --prefix PATH : ${clang}/bin
'';
testHaskellDepends = [ base containers HUnit ];
testTarget = "CarpHask-test";
postCheck = ''
env CARP=dist/build/carp/carp scripts/run_carp_tests.sh
'';
enableParallelBuilding = true;
homepage = "https://github.com/eriksvedang/Carp";
license = stdenv.lib.licenses.asl20;
};
haskellPackages = if compiler == "default"
then pkgs.haskellPackages
else pkgs.haskell.packages.${compiler};
drv = haskellPackages.callPackage f {};
in
if pkgs.lib.inNixShell then drv.env else drv