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