]> Git — Sourcephile - haskell/symantic-base.git/blob - flake.nix
build: set new fourmolu options
[haskell/symantic-base.git] / flake.nix
1 {
2 inputs = {
3 nixpkgs.url = "flake:nixpkgs";
4 pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
5 pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
6 };
7 outputs = inputs:
8 let
9 pkg = "symantic-base";
10 lib = inputs.nixpkgs.lib;
11 forAllSystems = f: lib.genAttrs lib.systems.flakeExposed (system: f rec {
12 inherit system;
13 pkgs = inputs.nixpkgs.legacyPackages.${system};
14 haskellPackages = pkgs.haskellPackages.extend (with pkgs.haskell.lib; hfinal: hsuper: {
15 ${pkg} = buildFromSdist (hfinal.callCabal2nix pkg ./. { });
16 });
17 });
18 in
19 rec {
20 # nix -L build
21 defaultPackage = forAllSystems ({ haskellPackages, ... }: haskellPackages.${pkg});
22 # nix -L develop or direnv allow
23 devShell = forAllSystems ({ pkgs, haskellPackages, system, ... }:
24 haskellPackages.shellFor {
25 packages = ps: [ ps.${pkg} ];
26 nativeBuildInputs = [
27 haskellPackages.cabal-install
28 haskellPackages.ghcid
29 haskellPackages.haskell-language-server
30 haskellPackages.hlint
31 pkgs.git-chglog
32 pkgs.reuse
33 ];
34 withHoogle = false;
35 inherit (checks.${system}.pre-commit-check) shellHook;
36 });
37 # nix flake check
38 checks = forAllSystems (args: with args; {
39 pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
40 src = ./.;
41 #settings.ormolu.cabalDefaultExtensions = true;
42 settings.ormolu.defaultExtensions = [
43 "ImportQualifiedPost"
44 "TypeApplications"
45 ];
46 hooks = {
47 hlint.enable = true;
48 nixpkgs-fmt.enable = true;
49 fourmolu.enable = true;
50 cabal-fmt.enable = true;
51 };
52 };
53 });
54 };
55 }