3 nixpkgs.url = "flake:nixpkgs";
4 git-hooks.url = "github:cachix/git-hooks.nix";
5 git-hooks.inputs.nixpkgs.follows = "nixpkgs";
6 logic.url = "git+https://radicle-mermet.sourcephile.fr/z3795BqJN8hSMGkyAUr8hHviEEi2H.git";
10 pkg = "literate-phylomemy";
11 lib = inputs.nixpkgs.lib;
12 fileInputs = with lib.fileset; toSource {
15 ./literate-phylomemy.cabal
19 (fileFilter (file: lib.any file.hasExt [ "hs" ]) ./src)
20 (fileFilter (file: lib.any file.hasExt [ "hs" "golden" ]) ./tests)
23 perSystem = f: lib.genAttrs lib.systems.flakeExposed (system: f rec {
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 logic = finalHaskellPkgs.callCabal2nix "logic" inputs.logic { };
29 #union-find = doJailbreak (finalHaskellPkgs.callHackage "union-find" "0.2" { });
30 #disjoint-containers = unmarkBroken previousHaskellPkgs.disjoint-containers;
31 #splaytree = doJailbreak (unmarkBroken previousHaskellPkgs.splaytree);
37 packages = perSystem ({ haskellPackages, ... }: {
38 default = haskellPackages.${pkg};
40 # nix -L develop or direnv allow
41 devShells = perSystem ({ pkgs, haskellPackages, system, ... }: {
43 haskellPackages.shellFor {
44 packages = ps: [ ps.${pkg} ];
46 haskellPackages.cabal-fmt
47 haskellPackages.cabal-install
49 haskellPackages.haskell-language-server
57 inherit (checks.${system}.git-hooks-check) shellHook;
61 checks = perSystem (args: with args; {
62 git-hooks-check = inputs.git-hooks.lib.${system}.run {
65 cabal-fmt.enable = true;
66 fourmolu.enable = true;
68 nixpkgs-fmt.enable = true;
69 ormolu.settings.cabalDefaultExtensions = true;
72 entry = "${pkgs.reuse}/bin/reuse lint";
73 pass_filenames = false;