|
344 | 344 | modules = haskellModules; |
345 | 345 | }; |
346 | 346 |
|
347 | | - in { |
| 347 | + formatCheckFor = system: |
| 348 | + let |
| 349 | + pkgs = nixpkgsFor system; |
| 350 | + in |
| 351 | + pkgs.runCommand "format-check" |
| 352 | + { nativeBuildInputs = [ self.devShell.${system}.nativeBuildInputs ]; } '' |
| 353 | + cd ${self} |
| 354 | + export LC_CTYPE=C.UTF-8 |
| 355 | + export LC_ALL=C.UTF-8 |
| 356 | + export LANG=C.UTF-8 |
| 357 | + export IN_NIX_SHELL='pure' |
| 358 | + make format_check cabalfmt_check nixpkgsfmt_check lint |
| 359 | + mkdir $out |
| 360 | + ''; |
| 361 | + |
| 362 | + in |
| 363 | + { |
348 | 364 | inherit cabalProjectLocal extraSources haskellModules; |
349 | 365 |
|
350 | 366 | project = perSystem projectFor; |
|
362 | 378 |
|
363 | 379 | # This will build all of the project's executables and the tests |
364 | 380 | check = perSystem (system: |
365 | | - (nixpkgsFor system).runCommand "combined-check" { |
366 | | - nativeBuildInputs = builtins.attrValues self.checks.${system} |
367 | | - ++ builtins.attrValues self.flake.${system}.packages |
368 | | - ++ [ self.devShell.${system}.inputDerivation self.devShell.${system}.nativeBuildInputs ]; |
369 | | - } '' |
370 | | - cd ${self} |
371 | | - export LC_CTYPE=C.UTF-8 |
372 | | - export LC_ALL=C.UTF-8 |
373 | | - export LANG=C.UTF-8 |
374 | | - export IN_NIX_SHELL='pure' |
375 | | - make format_check cabalfmt_check nixpkgsfmt_check lint |
376 | | - mkdir $out |
377 | | - ''); |
378 | | - |
| 381 | + (nixpkgsFor system).runCommand "combined-check" |
| 382 | + { |
| 383 | + nativeBuildInputs = builtins.attrValues self.checks.${system} |
| 384 | + ++ builtins.attrValues self.flake.${system}.packages |
| 385 | + ++ [ self.devShell.${system}.inputDerivation ]; |
| 386 | + } "touch $out"); |
379 | 387 | # NOTE `nix flake check` will not work at the moment due to use of |
380 | 388 | # IFD in haskell.nix |
381 | | - checks = perSystem (system: self.flake.${system}.checks); |
| 389 | + checks = perSystem (system: self.flake.${system}.checks // { |
| 390 | + formatCheck = formatCheckFor system; |
| 391 | + }); |
382 | 392 |
|
383 | 393 | herculesCI.ciSystems = [ "x86_64-linux" ]; |
384 | 394 | }; |
|
0 commit comments