-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
76 lines (75 loc) · 2.98 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
{
description = "Erlang and Haskell communication library";
inputs = {
nixpkgs.follows = "haskellNix/nixpkgs-unstable";
# Flake for better Haskell builds
# For updating to a newer fersion comment this line
haskellNix.url = "github:input-output-hk/haskell.nix";
# --------------------------------
# This is required for ./shell.nix
# And the ./shell.nix is required for the vscode
# nix-environment-selector plugin
flake-compat.url = "github:edolstra/flake-compat";
flake-compat.flake = false;
# --------------------------------
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {flake-utils, nixpkgs, haskellNix, ...}:
flake-utils.lib.eachSystem [flake-utils.lib.system.x86_64-linux] (system:
let
# Set the line below to 'true' to enable profiling builds
withProfiling = false;
pkgs = import nixpkgs {
inherit system overlays;
inherit (haskellNix) config;
};
overlays = [haskellNix.overlay (final: prev:
{
hinterface = final.haskell-nix.project {
src = final.haskell-nix.cleanSourceHaskell {
src = ./.;
name = "hinterface";
};
projectFileName = "cabal.project";
compiler-nix-name = "ghc944"; # "ghc925";
pkg-def-extras = [];
modules =
[
{
packages.hinterface.components.library = {
enableLibraryProfiling = withProfiling;
ghcOptions = if withProfiling then ["-fprof-auto"] else [];
};
packages.hinterface.components.exes.hinterface-echo = {
enableProfiling = withProfiling;
ghcOptions = if withProfiling then ["-fprof-auto"] else [];
};
packages.hinterface.components.tests.hinterface-test = {
enableProfiling = withProfiling;
ghcOptions = if withProfiling then ["-fprof-auto"] else [];
# HACK make 'cabal test' work
# https://github.com/input-output-hk/haskell.nix/issues/231#issuecomment-731699727
build-tools = [
final.hinterface.hsPkgs.hspec-discover
];
# END OF HACK
};
}
];
shell.tools = {
cabal = {};
hlint = {};
ormolu = {};
haskell-language-server = {};
};
# Non-Haskell shell tools go here
shell.buildInputs = with pkgs; [
alejandra
erlang
];
};
})];
in
pkgs.hinterface.flake {}
);
}