|
21 | 21 | url = "github:cachix/pre-commit-hooks.nix";
|
22 | 22 | inputs = {
|
23 | 23 | nixpkgs.follows = "nixpkgs";
|
24 |
| - flake-utils.follows = "flake-utils"; |
25 | 24 | };
|
26 | 25 | };
|
27 | 26 | jupyenv = {
|
|
68 | 67 | "^.*\.md"
|
69 | 68 | ];
|
70 | 69 |
|
71 |
| - monad-bayes-per-ghc = let |
72 |
| - opts = { |
| 70 | + # Always keep this up to date with the tested-with section in monad-bayes.cabal! |
| 71 | + # and the build-all-ghcs job in .github/workflows/nix.yml! |
| 72 | + ghcs = [ |
| 73 | + "ghc90" |
| 74 | + "ghc92" |
| 75 | + "ghc94" |
| 76 | + "ghc96" |
| 77 | + "ghc98" |
| 78 | + "ghc910" |
| 79 | + "default" |
| 80 | + ]; |
| 81 | + |
| 82 | + allHaskellPackages = lib.filterAttrs (ghcVersion: _: builtins.elem ghcVersion ghcs) (pkgs.haskell.packages // {default = pkgs.haskellPackages;}); |
| 83 | + |
| 84 | + monad-bayes-for = haskellPackages: haskellPackages.developPackage { |
73 | 85 | name = "monad-bayes";
|
74 | 86 | root = src;
|
75 | 87 | cabal2nixOptions = "--benchmark -fdev";
|
|
90 | 102 | microstache = doJailbreak super.microstache;
|
91 | 103 | };
|
92 | 104 | };
|
93 |
| - ghcs = [ |
94 |
| - # Always keep this up to date with the tested-with section in monad-bayes.cabal, |
95 |
| - # and the build-all-ghcs job in .github/workflows/nix.yml! |
96 |
| - "ghc902" |
97 |
| - "ghc927" |
98 |
| - "ghc945" |
99 |
| - "ghc964" |
100 |
| - "ghc982" |
101 |
| - "ghc9101" |
102 |
| - ]; |
103 |
| - buildForVersion = ghcVersion: (builtins.getAttr ghcVersion pkgs.haskell.packages).developPackage opts; |
104 |
| - in |
105 |
| - lib.attrsets.genAttrs ghcs buildForVersion; |
106 | 105 |
|
107 |
| - monad-bayes = monad-bayes-per-ghc.ghc902; |
| 106 | + monad-bayes-per-ghc = lib.mapAttrs (_: monad-bayes-for) allHaskellPackages; |
| 107 | + |
| 108 | + monad-bayes = monad-bayes-per-ghc.default; |
108 | 109 |
|
109 | 110 | monad-bayes-all-ghcs = pkgs.linkFarm "monad-bayes-all-ghcs" monad-bayes-per-ghc;
|
110 | 111 |
|
|
114 | 115 | ];
|
115 | 116 | };
|
116 | 117 |
|
117 |
| - monad-bayes-dev = pkgs.mkShell { |
118 |
| - inputsFrom = [monad-bayes.env]; |
119 |
| - packages = with pre-commit-hooks.packages.${system}; [ |
120 |
| - alejandra |
121 |
| - cabal-fmt |
122 |
| - hlint |
123 |
| - ormolu |
124 |
| - jupyterEnvironment |
125 |
| - ]; |
126 |
| - shellHook = pre-commit.shellHook; |
127 |
| - }; |
128 | 118 | pre-commit = pre-commit-hooks.lib.${system}.run {
|
129 | 119 | inherit src;
|
130 | 120 | hooks = {
|
|
140 | 130 | };
|
141 | 131 | packages.default = packages.monad-bayes;
|
142 | 132 | checks = {inherit monad-bayes pre-commit;};
|
143 |
| - devShells.default = monad-bayes-dev; |
| 133 | + devShells = builtins.mapAttrs (_ghcVersion: haskellPackages: haskellPackages.shellFor { |
| 134 | + packages = hps: [ |
| 135 | + (monad-bayes-for haskellPackages) |
| 136 | + ]; |
| 137 | + nativeBuildInputs = with pre-commit-hooks.packages.${system}; [ |
| 138 | + alejandra |
| 139 | + cabal-fmt |
| 140 | + hlint |
| 141 | + ormolu |
| 142 | + # jupyterEnvironment # FIXME: Builds monad-bayes |
| 143 | + ] ++ (with haskellPackages; [ |
| 144 | + haskell-language-server |
| 145 | + ]); |
| 146 | + }) allHaskellPackages; |
144 | 147 | # Needed for backwards compatibility with Nix versions <2.8
|
145 | 148 | defaultPackage = warnToUpdateNix packages.default;
|
146 | 149 | devShell = warnToUpdateNix devShells.default;
|
|
0 commit comments