dotfiles/templates/haskell/flake.nix
2025-10-01 19:51:55 -05:00

57 lines
1.4 KiB
Nix
Executable file

{
description = "Haskell Environment";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
treefmt-nix.url = "github:numtide/treefmt-nix";
};
outputs =
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ inputs.treefmt-nix.flakeModule ];
perSystem =
{ pkgs, ... }:
let
hp = pkgs.haskellPackages;
project = hp.callCabal2nix "project" ./. { };
in
{
devShells.default = hp.shellFor {
nativeBuildInputs = builtins.attrValues {
inherit (pkgs)
nil
stylish-haskell
ghc
;
inherit (hp)
cabal-install
cabal-gild
haskell-language-server
;
};
packages = _: [ project ];
};
packages.default = project;
treefmt = {
programs = {
cabal-fmt.enable = true;
deadnix.enable = true;
hlint.enable = true;
nixfmt.enable = true;
ormolu.enable = true;
statix.enable = true;
typstyle.enable = true;
yamlfmt.enable = true;
};
projectRootFile = "flake.nix";
};
};
systems = [ "x86_64-linux" ];
};
}