]> Git — Sourcephile - haskell/literate-web.git/blob - flake.nix
maint(nix): update nix inputs
[haskell/literate-web.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 symantic-base = { url = "git://git.sourcephile.fr/haskell/symantic-base"; flake = false; };
7 };
8 outputs = inputs:
9 let
10 pkg = "literate-web";
11 lib = inputs.nixpkgs.lib;
12 fileInputs = with lib.fileset; toSource {
13 root = ./.;
14 fileset = unions [
15 ./literate-web.cabal
16 #./ChangeLog.md
17 #./Readme.md
18 #./LICENSES
19 (fileFilter (file: lib.any file.hasExt [ "hs" ]) ./src)
20 (fileFilter (file: lib.any file.hasExt [ "hs" "golden" ]) ./tests)
21 ];
22 };
23 perSystem = f: lib.genAttrs lib.systems.flakeExposed (system: f rec {
24 inherit system;
25 pkgs = inputs.nixpkgs.legacyPackages.${system};
26 haskellPackages = pkgs.haskellPackages.extend (with pkgs.haskell.lib; finalHaskellPkgs: previousHaskellPkgs: {
27 ${pkg} = buildFromSdist (finalHaskellPkgs.callCabal2nix pkg fileInputs { });
28 symantic-base = finalHaskellPkgs.callCabal2nix "symantic-base" inputs.symantic-base { };
29 mvc = dontCheck (doJailbreak (unmarkBroken hsuper.mvc));
30 mvc-updates = dontCheck (doJailbreak (unmarkBroken (
31 appendPatch hsuper.mvc-updates ./0001-mvc-updates-fix-L.pretraverseM.patch
32 )));
33 });
34 });
35 in
36 rec {
37 # nix -L build
38 packages = perSystem ({ haskellPackages, ... }: {
39 default = haskellPackages.${pkg};
40 });
41 # nix -L develop or direnv allow
42 devShells = perSystem ({ pkgs, haskellPackages, system, ... }: {
43 default =
44 haskellPackages.shellFor {
45 packages = ps: [ ps.${pkg} ];
46 nativeBuildInputs = [
47 haskellPackages.cabal-fmt
48 haskellPackages.cabal-install
49 haskellPackages.ghcid
50 haskellPackages.haskell-language-server
51 haskellPackages.hlint
52 pkgs.git-chglog
53 pkgs.reuse
54 ];
55 withHoogle = false;
56 inherit (checks.${system}.git-hooks-check) shellHook;
57 };
58 });
59 # nix flake check
60 checks = perSystem (args: with args; {
61 git-hooks-check = inputs.git-hooks.lib.${system}.run {
62 src = ./.;
63 hooks = {
64 cabal-fmt.enable = true;
65 fourmolu.enable = true;
66 hlint.enable = true;
67 nixpkgs-fmt.enable = true;
68 ormolu.settings.cabalDefaultExtensions = true;
69 ormolu.settings.defaultExtensions = [
70 "ImportQualifiedPost"
71 "TypeApplications"
72 ];
73 reuse = {
74 enable = false;
75 entry = "${pkgs.reuse}/bin/reuse lint";
76 pass_filenames = false;
77 };
78 };
79 };
80 });
81 };
82 }