-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
90 lines (80 loc) · 2.54 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
{
inputs.haskellNix.url = "github:input-output-hk/haskell.nix";
inputs.nixpkgs.follows = "haskellNix/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.feedback.url = "github:NorfairKing/feedback";
outputs = { self, nixpkgs, flake-utils, haskellNix, feedback }:
let
supportedSystems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
in
flake-utils.lib.eachSystem supportedSystems (system:
let
haskellProject = (final: prev: {
hixProject =
final.haskell-nix.hix.project {
src = ./.;
evalSystem = "x86_64-linux";
};
});
feedbackOverlay = (final: prev: { feedback = feedback.packages.${system}.default; });
checks = (final: prev: {
fourmolu = final.haskell-nix.tool
final.hixProject.args.compiler-nix-name
"fourmolu"
{ version = "latest"; };
hlintCheck = prev.runCommand "hlint-check" { buildInputs = [final.hlint]; } ''
cd "${final.hixProject.args.src}"
hlint app src test
if [[ "$?" -eq 0 ]]; then
touch $out
fi
'';
fourmoluCheck =
prev.runCommand
"fourmolu-check"
{
buildInputs = [ final.fourmolu ];
}
''
cd "${final.hixProject.args.src}"
fourmolu --mode check app src test
if [[ "$?" -eq 0 ]]; then
touch $out
fi
'';
});
overlays = [
haskellNix.overlay
haskellProject
checks
feedbackOverlay
];
pkgs = import nixpkgs { inherit system overlays; inherit (haskellNix) config; };
flake = pkgs.hixProject.flake {};
in flake // {
checks = {
inherit (pkgs) hlintCheck fourmoluCheck;
};
legacyPackages = pkgs;
packages = flake.packages // {
default = flake.packages."seangine:exe:seangine";
inherit (pkgs) hlintCheck fourmoluCheck;
};
});
nixConfig = {
extra-substituters = [
"https://sgillespie.cachix.org"
"https://cache.iog.io"
];
extra-trusted-public-keys = [
"sgillespie.cachix.org-1:Zgif/WHW2IzHqbMb1z56cMmV5tLAA+zW9d5iB5w/VU4="
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
];
allow-import-from-derivation = "true";
};
}