summary refs log tree commit diff
path: root/pkgs/build-support/trivial-builders
diff options
context:
space:
mode:
authorFrancesco Gazzetta <fgaz@fgaz.me>2023-06-28 16:07:13 +0200
committerFrancesco Gazzetta <fgaz@fgaz.me>2023-08-05 18:31:20 +0200
commit2c5990f03aac1dd0fd48855fc8e5ca9abff34991 (patch)
treea9246bf481f3ebe2b14b74872b56f8e6a78241e4 /pkgs/build-support/trivial-builders
parent17544589b02100b9fa5c49fca82dfe489a060053 (diff)
downloadnixpkgs-2c5990f03aac1dd0fd48855fc8e5ca9abff34991.tar
nixpkgs-2c5990f03aac1dd0fd48855fc8e5ca9abff34991.tar.gz
nixpkgs-2c5990f03aac1dd0fd48855fc8e5ca9abff34991.tar.bz2
nixpkgs-2c5990f03aac1dd0fd48855fc8e5ca9abff34991.tar.lz
nixpkgs-2c5990f03aac1dd0fd48855fc8e5ca9abff34991.tar.xz
nixpkgs-2c5990f03aac1dd0fd48855fc8e5ca9abff34991.tar.zst
nixpkgs-2c5990f03aac1dd0fd48855fc8e5ca9abff34991.zip
writeShellApplication: use shellcheck only where supported
Diffstat (limited to 'pkgs/build-support/trivial-builders')
-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 d095974513c..f6734bc0a03 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;