-
Notifications
You must be signed in to change notification settings - Fork 12
/
flake.nix
85 lines (79 loc) · 2.56 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
{
description = "Ply - A helper library for working with compiled, parameterized Plutus Scripts";
inputs = {
haskellNix.url = "github:input-output-hk/haskell.nix";
nixpkgs.follows = "haskellNix/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
CHaP = {
url = "github:input-output-hk/cardano-haskell-packages?ref=repo";
flake = false;
};
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
iohk-nix.url = "github:input-output-hk/iohk-nix";
};
outputs = { nixpkgs, flake-utils, haskellNix, CHaP, pre-commit-hooks, iohk-nix, ... }:
let
# NOTE: nix flake (show | check) --allow-import-from-derivation --impure
systems =
if builtins.hasAttr "currentSystem" builtins
then [ builtins.currentSystem ]
else nixpkgs.lib.systems.flakeExposed;
in
flake-utils.lib.eachSystem systems (system:
let
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
settings = {
ormolu.defaultExtensions = [
"TypeApplications"
"PatternSynonyms"
];
};
hooks = {
nixpkgs-fmt.enable = true;
cabal-fmt.enable = true;
fourmolu.enable = true;
hlint.enable = true;
statix.enable = true;
deadnix.enable = true;
};
};
pkgs = import nixpkgs {
inherit system;
overlays = [
haskellNix.overlay
iohk-nix.overlays.crypto
iohk-nix.overlays.haskell-nix-crypto
];
inherit (haskellNix) config;
};
ply = pkgs.haskell-nix.cabalProject' {
src = ./.;
compiler-nix-name = "ghc96";
shell = {
# This is used by `nix develop .` to open a shell for use with
# `cabal`, `hlint` and `haskell-language-server` etc
tools = {
cabal = { };
haskell-language-server = { };
};
# Non-Haskell shell tools go here
nativeBuildInputs = with pkgs; [
nixpkgs-fmt
fd
git
gnumake
];
shellHook = pre-commit-check.shellHook +
''
echo $name
'';
};
inputMap = { "https://input-output-hk.github.io/cardano-haskell-packages" = CHaP; };
};
flake = ply.flake { };
in
flake // {
checks = flake.checks // { formatting-checks = pre-commit-check; };
});
}