-
Notifications
You must be signed in to change notification settings - Fork 9
/
flake.nix
60 lines (56 loc) · 1.79 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
{
description = "Ema project";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
haskell-flake.url = "github:srid/haskell-flake";
treefmt-nix.url = "github:numtide/treefmt-nix";
flake-root.url = "github:srid/flake-root";
emanote.url = "github:srid/emanote";
};
outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = nixpkgs.lib.systems.flakeExposed;
imports = [
inputs.haskell-flake.flakeModule
inputs.flake-root.flakeModule
inputs.treefmt-nix.flakeModule
inputs.emanote.flakeModule
];
perSystem = { config, pkgs, ... }: {
# This attr is provided by https://github.com/srid/haskell-flake
haskellProjects.default = {
devShell.tools = hp: {
treefmt = config.treefmt.build.wrapper;
} // config.treefmt.build.programs;
};
# treefmt-nix configuration
treefmt.config = {
inherit (config.flake-root) projectRootFile;
package = pkgs.treefmt;
programs.ormolu.enable = true;
programs.nixpkgs-fmt.enable = true;
programs.cabal-fmt.enable = true;
# We use fourmolu
programs.ormolu.package = pkgs.haskellPackages.fourmolu;
settings.formatter.ormolu = {
options = [
"--ghc-opt"
"-XImportQualifiedPost"
"--ghc-opt"
"-XTypeApplications"
];
};
};
emanote = {
sites = {
"docs" = {
layers = [ ./docs ];
layersString = [ "./docs" ];
prettyUrls = true;
};
};
};
};
};
}