1
1
mirror of https://github.com/srid/ema.git synced 2024-11-25 09:34:04 +03:00
ema/flake.nix
2024-03-09 20:34:52 -05:00

61 lines
1.8 KiB
Nix

{
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;
};
};
};
};
};
}