-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
111 lines (100 loc) · 3.43 KB
/
flake.nix
File metadata and controls
111 lines (100 loc) · 3.43 KB
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
106
107
108
109
110
111
{
description = "SAT, the satisfiability checker";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
pre-commit.url = "github:cachix/git-hooks.nix";
pre-commit.inputs.nixpkgs.follows = "nixpkgs";
treefmt.url = "github:numtide/treefmt-nix";
treefmt.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
imports = with inputs; [
pre-commit.flakeModule
treefmt.flakeModule
];
systems = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-linux"
];
perSystem =
{
config,
lib,
pkgs,
self',
...
}:
let
hPkgs = pkgs.haskellPackages;
pre-commit = config.pre-commit.settings;
# Circumvent a bug in the interaction of Cabal and `shellFor`.
# https://gist.github.com/ScottFreeCode/ef9f254e2dd91544bba4a068852fc81f
# https://github.com/NixOS/nixpkgs/issues/130556#issuecomment-2762237786
cabal-in-nix = pkgs.writeShellScriptBin "cabal" ''
${lib.getExe hPkgs.cabal-install} --flags=+nix "$@"
'';
satDevShell = hPkgs.shellFor {
packages = _: [ self'.packages.default ];
withHoogle = true;
nativeBuildInputs = [
cabal-in-nix
hPkgs.haskell-language-server
];
};
in
{
packages.default = hPkgs.developPackage {
name = "sat";
root = ./.;
};
apps.default = {
type = "app";
program = "${self'.packages.default}/bin/sat";
meta.description = "The SAT checker";
};
devShells.default = pkgs.mkShell {
inputsFrom = [ satDevShell ] ++ lib.optional pre-commit.enable config.pre-commit.devShell;
};
pre-commit.settings = {
package = pkgs.prek;
hooks = {
check-added-large-files.enable = true;
check-merge-conflicts.enable = true;
check-symlinks.enable = true;
check-vcs-permalinks.enable = true;
convco.enable = true;
deadnix.enable = true;
detect-private-keys.enable = true;
hlint.enable = true;
markdownlint.enable = true;
markdownlint.settings.configuration.line_length = false;
mixed-line-endings.enable = true;
statix.enable = true;
statix.settings.format = "stderr";
treefmt.enable = true;
trim-trailing-whitespace.enable = true;
typos.enable = true;
};
};
treefmt = {
flakeCheck = !(pre-commit.enable && pre-commit.hooks.treefmt.enable);
programs = {
cabal-gild.enable = true;
fourmolu.enable = true;
fourmolu.ghcOpts = [ "ImportQualifiedPost" ];
mdformat.enable = true;
mdformat.settings.wrap = "no";
nixfmt.enable = true;
nixf-diagnose.enable = true;
nixf-diagnose.ignore = [ "sema-primop-overridden" ];
yamlfmt.enable = true;
};
settings.formatter.fourmolu.options = [ "--config=${./fourmolu.yaml}" ];
};
};
};
}