]> Git — Sourcephile - haskell/symantic-base.git/blob - flake.nix
iface: add interpreter `LetInserter`
[haskell/symantic-base.git] / flake.nix
1 {
2 inputs = {
3 nixpkgs.url = "flake:nixpkgs";
4 git-hooks.url = "github:cachix/git-hooks.nix";
5 git-hooks.inputs.nixpkgs.follows = "nixpkgs";
6 };
7 outputs = inputs:
8 let
9 pkg = "symantic-base";
10 lib = inputs.nixpkgs.lib;
11 fileInputs = with lib.fileset; toSource {
12 root = ./.;
13 fileset = unions [
14 ./symantic-base.cabal
15 ./LICENSES
16 (fileFilter (file: lib.any file.hasExt [ ".hs" ]) ./src)
17 (fileFilter (file: lib.any file.hasExt [ ".hs" ]) ./tests)
18 ];
19 };
20 forAllSystems = f: lib.genAttrs lib.systems.flakeExposed (system: f rec {
21 inherit system;
22 pkgs = inputs.nixpkgs.legacyPackages.${system};
23 haskellPackages = pkgs.haskellPackages.extend (with pkgs.haskell.lib; hfinal: hsuper: {
24 ${pkg} = buildFromSdist (hfinal.callCabal2nix pkg fileInputs { });
25 });
26 });
27 in
28 rec {
29 # nix -L build
30 packages = forAllSystems ({ haskellPackages, ... }: {
31 default = haskellPackages.${pkg};
32 });
33 # nix -L develop or direnv allow
34 devShells = forAllSystems ({ pkgs, haskellPackages, system, ... }: {
35 default =
36 haskellPackages.shellFor {
37 packages = ps: [ ps.${pkg} ];
38 nativeBuildInputs = [
39 haskellPackages.cabal-install
40 haskellPackages.ghcid
41 haskellPackages.haskell-language-server
42 haskellPackages.hlint
43 pkgs.git-chglog
44 pkgs.reuse
45 ];
46 withHoogle = false;
47 inherit (checks.${system}.git-hooks-check) shellHook;
48 };
49 });
50 # nix flake check
51 checks = forAllSystems (args: with args; {
52 git-hooks-check = inputs.git-hooks.lib.${system}.run {
53 src = ./.;
54 hooks = {
55 ormolu.settings.cabalDefaultExtensions = true;
56 cabal-fmt.enable = true;
57 fourmolu.enable = true;
58 hlint.enable = true;
59 nixpkgs-fmt.enable = true;
60 reuse = {
61 enable = true;
62 entry = "${pkgs.reuse}/bin/reuse lint";
63 pass_filenames = false;
64 };
65 };
66 };
67 });
68 };
69 }