summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrancesco Gazzetta <fgaz@fgaz.me>2023-08-09 12:17:46 +0200
committerGitHub <noreply@github.com>2023-08-09 12:17:46 +0200
commitb2e987dd163f7c3ff689856ebf391f557eedb2aa (patch)
treefa51627562b1bd3d43ff75605e61f17d445fc8ec
parente9297c816197a139b681860d152a623f64e43790 (diff)
parent2c5990f03aac1dd0fd48855fc8e5ca9abff34991 (diff)
downloadnixpkgs-b2e987dd163f7c3ff689856ebf391f557eedb2aa.tar
nixpkgs-b2e987dd163f7c3ff689856ebf391f557eedb2aa.tar.gz
nixpkgs-b2e987dd163f7c3ff689856ebf391f557eedb2aa.tar.bz2
nixpkgs-b2e987dd163f7c3ff689856ebf391f557eedb2aa.tar.lz
nixpkgs-b2e987dd163f7c3ff689856ebf391f557eedb2aa.tar.xz
nixpkgs-b2e987dd163f7c3ff689856ebf391f557eedb2aa.tar.zst
nixpkgs-b2e987dd163f7c3ff689856ebf391f557eedb2aa.zip
Merge pull request #240348 from fgaz/write-shell-application/check-platforms
writeShellApplication: use shellcheck only where supported
-rw-r--r--pkgs/build-support/trivial-builders/default.nix14
1 files changed, 11 insertions, 3 deletions
diff --git a/pkgs/build-support/trivial-builders/default.nix b/pkgs/build-support/trivial-builders/default.nix
index dcdac09004b..0c63cc5a9be 100644
--- a/pkgs/build-support/trivial-builders/default.nix
+++ b/pkgs/build-support/trivial-builders/default.nix
@@ -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;