2021-05-31 23:19:51 +00:00
|
|
|
{
|
2022-05-30 13:16:38 +00:00
|
|
|
description = "srid/haskell-template: Nix template for Haskell projects";
|
2021-05-31 23:19:51 +00:00
|
|
|
inputs = {
|
2022-05-07 00:27:11 +00:00
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
2022-05-26 11:25:38 +00:00
|
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
2022-05-30 13:16:38 +00:00
|
|
|
haskell-flake.url = "github:srid/haskell-flake";
|
2022-08-17 18:23:47 +00:00
|
|
|
treefmt-flake.url = "github:srid/treefmt-flake";
|
2022-12-17 17:29:11 +00:00
|
|
|
mission-control.url = "github:Platonic-Systems/mission-control";
|
2021-05-31 23:19:51 +00:00
|
|
|
};
|
2022-04-27 22:55:51 +00:00
|
|
|
|
2022-08-28 22:50:08 +00:00
|
|
|
outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
|
2022-05-26 11:25:38 +00:00
|
|
|
flake-parts.lib.mkFlake { inherit self; } {
|
2022-05-27 20:31:08 +00:00
|
|
|
systems = nixpkgs.lib.systems.flakeExposed;
|
2022-05-30 13:16:38 +00:00
|
|
|
imports = [
|
2022-08-28 22:50:08 +00:00
|
|
|
inputs.haskell-flake.flakeModule
|
|
|
|
inputs.treefmt-flake.flakeModule
|
2022-12-17 17:29:11 +00:00
|
|
|
inputs.mission-control.flakeModule
|
2022-05-30 13:16:38 +00:00
|
|
|
];
|
2022-12-17 17:29:11 +00:00
|
|
|
perSystem = { self', lib, config, pkgs, ... }: {
|
|
|
|
# The "main" project. You can have multiple projects, but this template has only one.
|
|
|
|
haskellProjects.main = {
|
2022-11-09 20:59:00 +00:00
|
|
|
packages = {
|
|
|
|
haskell-template.root = ./.;
|
|
|
|
};
|
2022-12-19 13:58:06 +00:00
|
|
|
buildTools = hp: { } // config.treefmt.formatters;
|
2022-09-14 20:46:58 +00:00
|
|
|
# overrides = self: super: {}
|
2022-09-30 18:24:09 +00:00
|
|
|
hlsCheck.enable = true;
|
|
|
|
hlintCheck.enable = true;
|
2022-08-17 18:23:47 +00:00
|
|
|
};
|
|
|
|
treefmt.formatters = {
|
|
|
|
inherit (pkgs)
|
|
|
|
nixpkgs-fmt;
|
|
|
|
inherit (pkgs.haskellPackages)
|
|
|
|
cabal-fmt
|
|
|
|
fourmolu;
|
2022-05-26 11:25:38 +00:00
|
|
|
};
|
2022-12-17 17:29:11 +00:00
|
|
|
mission-control.scripts = {
|
|
|
|
docs = {
|
|
|
|
description = "Start Hoogle server for project dependencies";
|
|
|
|
command = ''
|
|
|
|
echo http://127.0.0.1:8888
|
|
|
|
hoogle serve -p 8888 --local
|
|
|
|
'';
|
|
|
|
category = "Dev Tools";
|
|
|
|
};
|
|
|
|
repl = {
|
|
|
|
description = "Start the cabal repl";
|
|
|
|
command = ''
|
|
|
|
cabal repl "$@"
|
|
|
|
'';
|
|
|
|
category = "Dev Tools";
|
|
|
|
};
|
|
|
|
fmt = {
|
2022-12-19 13:58:06 +00:00
|
|
|
description = "Format the source tree";
|
|
|
|
command = "${lib.getExe pkgs.treefmt}";
|
|
|
|
category = "Dev Tools ";
|
2022-12-17 17:29:11 +00:00
|
|
|
};
|
|
|
|
run = {
|
|
|
|
description = "Run the project with ghcid auto-recompile";
|
|
|
|
command = ''
|
|
|
|
ghcid -c "cabal repl exe:haskell-template" --warnings -T :main
|
|
|
|
'';
|
|
|
|
category = "Primary";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
packages.default = self'.packages.main-haskell-template;
|
|
|
|
devShells.default =
|
|
|
|
config.mission-control.installToDevShell config.devShells.main;
|
2022-05-30 13:16:38 +00:00
|
|
|
};
|
2022-05-26 11:25:38 +00:00
|
|
|
};
|
2021-05-31 23:19:51 +00:00
|
|
|
}
|