b21f59e123
* flake.lock: Update Flake lock file updates: • Updated input 'flake-parts': 'github:hercules-ci/flake-parts/d591857e9d7dd9ddbfba0ea02b43b927c3c0f1fa' (2022-11-14) → 'github:hercules-ci/flake-parts/3f7172646953bf86dad5953bc45f0edae62ac445' (2022-12-18) • Updated input 'haskell-flake': 'github:srid/haskell-flake/4fc511d93a55fedf815c1647ad146c26d7a2054e' (2022-11-11) → 'github:srid/haskell-flake/54334cfae9bbb73732bbb1437260017044f68d0b' (2022-12-19) • Updated input 'nixpkgs': 'github:nixos/nixpkgs/a2d2f70b82ada0eadbcb1df2bca32d841a3c1bf1' (2022-12-04) → 'github:nixos/nixpkgs/bb31220cca6d044baa6dc2715b07497a2a7c4bc7' (2022-12-19) * Fix flake-parts warning Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
83 lines
2.7 KiB
Nix
83 lines
2.7 KiB
Nix
{
|
|
description = "srid/haskell-template: Nix template for Haskell projects";
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
haskell-flake.url = "github:srid/haskell-flake";
|
|
treefmt-flake.url = "github:srid/treefmt-flake";
|
|
flake-root.url = "github:srid/flake-root";
|
|
mission-control.url = "github:Platonic-Systems/mission-control";
|
|
};
|
|
|
|
outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
|
|
flake-parts.lib.mkFlake { inherit inputs; } {
|
|
systems = nixpkgs.lib.systems.flakeExposed;
|
|
imports = [
|
|
inputs.haskell-flake.flakeModule
|
|
inputs.treefmt-flake.flakeModule
|
|
inputs.flake-root.flakeModule
|
|
inputs.mission-control.flakeModule
|
|
];
|
|
perSystem = { self', lib, config, pkgs, ... }: {
|
|
# The "main" project. You can have multiple projects, but this template
|
|
# has only one.
|
|
haskellProjects.main = {
|
|
packages = {
|
|
haskell-template.root = ./.;
|
|
};
|
|
buildTools = hp: { } // config.treefmt.formatters;
|
|
# overrides = self: super: {}
|
|
hlsCheck.enable = true;
|
|
hlintCheck.enable = true;
|
|
};
|
|
|
|
# Auto formatters. This also adds a flake check to ensure that the
|
|
# source tree was auto formatted.
|
|
treefmt.formatters = {
|
|
inherit (pkgs)
|
|
nixpkgs-fmt;
|
|
inherit (pkgs.haskellPackages)
|
|
cabal-fmt
|
|
fourmolu;
|
|
};
|
|
|
|
# Dev shell scripts.
|
|
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 = {
|
|
description = "Format the source tree";
|
|
command = "${lib.getExe pkgs.treefmt}";
|
|
category = "Dev Tools ";
|
|
};
|
|
run = {
|
|
description = "Run the project with ghcid auto-recompile";
|
|
command = ''
|
|
ghcid -c "cabal repl exe:haskell-template" --warnings -T :main
|
|
'';
|
|
category = "Primary";
|
|
};
|
|
};
|
|
|
|
# Default package.
|
|
packages.default = self'.packages.main-haskell-template;
|
|
|
|
# Default shell.
|
|
devShells.default =
|
|
config.mission-control.installToDevShell self'.devShells.main;
|
|
};
|
|
};
|
|
}
|