Skip to content

Commit

Permalink
writeShellApplication: use shellcheck only where supported
Browse files Browse the repository at this point in the history
  • Loading branch information
fgaz committed Aug 5, 2023
1 parent 1754458 commit 2c5990f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pkgs/build-support/trivial-builders/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,20 @@ rec {
'';

checkPhase =
# GHC (=> shellcheck) isn't supported on some platforms (such as risc-v)
# but we still want to use writeShellApplication on those platforms
let
shellcheckSupported = lib.meta.availableOn stdenv.buildPlatform shellcheck.compiler;
shellcheckCommand = lib.optionalString shellcheckSupported ''
# use shellcheck which does not include docs
# pandoc takes long to build and documentation isn't needed for just running the cli
${lib.getExe (haskell.lib.compose.justStaticExecutables shellcheck.unwrapped)} "$target"
'';
in
if checkPhase == null then ''
runHook preCheck
${stdenv.shellDryRun} "$target"
# use shellcheck which does not include docs
# pandoc takes long to build and documentation isn't needed for in nixpkgs usage
${lib.getExe (haskell.lib.compose.justStaticExecutables shellcheck.unwrapped)} "$target"
${shellcheckCommand}
runHook postCheck
''
else checkPhase;
Expand Down

0 comments on commit 2c5990f

Please sign in to comment.