-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
94 lines (85 loc) · 2.55 KB
/
flake.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
haskell-flake.url = "github:srid/haskell-flake";
};
outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = nixpkgs.lib.systems.flakeExposed;
imports = [
inputs.haskell-flake.flakeModule
];
perSystem = { self', pkgs, lib, config, ... }:
let
projectRoot = builtins.toString (lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.unions [
./bin
./src
./specs
./include
./cpp
./chelleport.cabal
];
});
otherFiles = [
{ source = ./static; target = "static"; }
{ source = ./include; target = "include"; }
];
configurationFlags = [
"--ghc-options=-O2"
];
buildInputs = with pkgs; [
xorg.libXtst
xorg.libX11
SDL2
SDL2_ttf
tesseract
leptonica
gcc
pkg-config
];
devPackages = with pkgs; [
just
nodemon
clang-tools
valgrind
];
in {
haskellProjects.default = {
inherit projectRoot;
packages = {};
settings = {
chelleport = {
check = true;
deadCodeElimination = true;
staticLibraries = true;
strip = true;
custom = drv:
(pkgs.haskell.lib.compose.appendConfigureFlags configurationFlags drv).overrideAttrs (old: {
preBuild = ''
${toString (map (f: ''cp -r ${f.source} ${f.target};'') otherFiles)}
'';
})
;
};
};
devShell = {
hlsCheck.enable = true;
};
autoWire = [ "packages" "apps" "checks" ];
};
packages.default = self'.packages.chelleport;
apps.default = self'.apps.chelleport;
devShells.default = pkgs.mkShell {
inputsFrom = [
config.haskellProjects.default.outputs.devShell
];
packages = devPackages;
inherit buildInputs;
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath buildInputs}";
};
};
};
}