summary refs log tree commit diff
path: root/pkgs/build-support/trivial-builders/default.nix
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2023-10-19 18:01:22 +0000
committerGitHub <noreply@github.com>2023-10-19 18:01:22 +0000
commit024144542b9553e2d098ae3b3ab7f0690d71a51a (patch)
treec717f5c91b5d63a6e8c2d8738f02889ff900a106 /pkgs/build-support/trivial-builders/default.nix
parent026763c623c83496187633f45e5c877772b09f37 (diff)
parent0bcaa2f556ace563a74ef93125c439a01d4f8dec (diff)
downloadnixpkgs-024144542b9553e2d098ae3b3ab7f0690d71a51a.tar
nixpkgs-024144542b9553e2d098ae3b3ab7f0690d71a51a.tar.gz
nixpkgs-024144542b9553e2d098ae3b3ab7f0690d71a51a.tar.bz2
nixpkgs-024144542b9553e2d098ae3b3ab7f0690d71a51a.tar.lz
nixpkgs-024144542b9553e2d098ae3b3ab7f0690d71a51a.tar.xz
nixpkgs-024144542b9553e2d098ae3b3ab7f0690d71a51a.tar.zst
nixpkgs-024144542b9553e2d098ae3b3ab7f0690d71a51a.zip
Merge staging-next into staging
Diffstat (limited to 'pkgs/build-support/trivial-builders/default.nix')
-rw-r--r--pkgs/build-support/trivial-builders/default.nix6
1 files changed, 5 insertions, 1 deletions
diff --git a/pkgs/build-support/trivial-builders/default.nix b/pkgs/build-support/trivial-builders/default.nix
index 8b8732af065..f7adfad455b 100644
--- a/pkgs/build-support/trivial-builders/default.nix
+++ b/pkgs/build-support/trivial-builders/default.nix
@@ -311,6 +311,8 @@ rec {
     Similar to writeShellScriptBin and writeScriptBin.
     Writes an executable Shell script to /nix/store/<store path>/bin/<name> and
     checks its syntax with shellcheck and the shell's -n option.
+    Individual checks can be foregone by putting them in the excludeShellChecks
+    list, e.g. [ "SC2016" ].
     Automatically includes sane set of shellopts (errexit, nounset, pipefail)
     and handles creation of PATH based on runtimeInputs
 
@@ -338,6 +340,7 @@ rec {
     , runtimeInputs ? [ ]
     , meta ? { }
     , checkPhase ? null
+    , excludeShellChecks ? [  ]
     }:
     writeTextFile {
       inherit name meta;
@@ -363,10 +366,11 @@ rec {
         # but we still want to use writeShellApplication on those platforms
         let
           shellcheckSupported = lib.meta.availableOn stdenv.buildPlatform shellcheck.compiler;
+          excludeOption = lib.optionalString (excludeShellChecks != [  ]) "--exclude '${lib.concatStringsSep "," excludeShellChecks}'";
           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"
+            ${lib.getExe (haskell.lib.compose.justStaticExecutables shellcheck.unwrapped)} ${excludeOption} "$target"
           '';
         in
         if checkPhase == null then ''