mirror of
https://github.com/carp-lang/Carp.git
synced 2024-08-15 00:00:34 +03:00
37 lines
1.1 KiB
Nix
37 lines
1.1 KiB
Nix
{ pkgs ? import <nixpkgs> {}
|
|
, profiling ? false
|
|
, doCheck ? true
|
|
}:
|
|
let
|
|
odrv = with pkgs; with haskellPackages; developPackage {
|
|
root = ./.;
|
|
name = "CarpHask";
|
|
modifier = lib.flip haskell.lib.overrideCabal (_: {
|
|
buildTools = [
|
|
cabal-install clang gdb
|
|
ormolu hlint flamegraph ghc-prof-flamegraph
|
|
] ++ lib.optionals stdenv.isLinux [ linuxPackages.perf tinycc zig ];
|
|
pkgconfigDepends = [ SDL2 SDL2_image SDL2_mixer SDL2_ttf glfw ];
|
|
enableLibraryProfiling = profiling;
|
|
enableExecutableProfiling = profiling;
|
|
enableSharedLibraries = false;
|
|
enableSharedExecutables = false;
|
|
});
|
|
};
|
|
drv = with pkgs; odrv.overrideAttrs (o: {
|
|
inherit doCheck;
|
|
buildInputs = o.buildInputs ++ [ makeWrapper pkgconfig ];
|
|
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
|
|
'';
|
|
postCheck = ''
|
|
env CARP=dist/build/carp/carp scripts/run_carp_tests.sh
|
|
'';
|
|
enableParallelBuilding = true;
|
|
});
|
|
in drv
|