-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
flake.nix
105 lines (94 loc) · 2.37 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
95
96
97
98
99
100
101
102
103
104
105
{
description = "Debug Adapter for Haskell debugging system.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
haskell-dap.url = "github:phoityne/haskell-dap";
ghci-dap.url = "github:phoityne/ghci-dap";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
flake-utils.url = "github:numtide/flake-utils";
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
haskell-dap,
ghci-dap,
pre-commit-hooks,
flake-utils,
...
}: let
supportedSystems = [
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
"x86_64-linux"
];
overlay = import ./nix/overlay.nix;
in
flake-utils.lib.eachSystem supportedSystems (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [
overlay
haskell-dap.overlays.default
ghci-dap.overlays.default
];
};
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = self;
hooks = {
cabal2nix.enable = true;
alejandra.enable = true;
hpack.enable = true;
};
settings = {
alejandra.exclude = ["default.nix"];
};
};
devShell = pkgs.haskellPackages.shellFor {
name = "haskell-debug-adapter-devShell";
packages = p:
with p; [
haskell-debug-adapter
];
withHoogle = true;
buildInputs =
(with pkgs; [
haskell-language-server
cabal-install
haskellPackages.implicit-hie
zlib
])
++ (with pre-commit-hooks.packages.${system}; [
hpack
cabal2nix
alejandra
]);
shellHook = ''
gen-hie --cabal > hie.yaml
${self.checks.${system}.pre-commit-check.shellHook}
'';
};
in {
devShells = {
default = devShell;
};
packages = rec {
default = haskell-debug-adapter;
haskell-debug-adapter = pkgs.haskellPackages.haskell-debug-adapter;
};
checks = {
inherit pre-commit-check;
haskell-debug-adapter = self.packages.${system}.default;
};
})
// {
overlays.default = overlay;
};
}