Skip to content

Commit 773d2a1

Browse files
committed
format in checks flake output
1 parent 9b3be24 commit 773d2a1

File tree

1 file changed

+26
-16
lines changed

1 file changed

+26
-16
lines changed

flake.nix

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,23 @@
344344
modules = haskellModules;
345345
};
346346

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+
{
348364
inherit cabalProjectLocal extraSources haskellModules;
349365

350366
project = perSystem projectFor;
@@ -362,23 +378,17 @@
362378

363379
# This will build all of the project's executables and the tests
364380
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");
379387
# NOTE `nix flake check` will not work at the moment due to use of
380388
# 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+
});
382392

383393
herculesCI.ciSystems = [ "x86_64-linux" ];
384394
};

0 commit comments

Comments
 (0)