shellcheck-minimal: init

Expose the minimal and stripped shellcheck package used by writeShellApplication.
This commit is contained in:
Yueh-Shun Li 2023-11-01 05:48:22 +08:00
parent 2d3a5c7ddb
commit 409f95731e
3 changed files with 11 additions and 5 deletions

View File

@ -1,4 +1,4 @@
{ lib, stdenv, stdenvNoCC, lndir, runtimeShell, shellcheck, haskell }: { lib, stdenv, stdenvNoCC, lndir, runtimeShell, shellcheck-minimal }:
let let
inherit (lib) inherit (lib)
@ -365,12 +365,12 @@ rec {
# GHC (=> shellcheck) isn't supported on some platforms (such as risc-v) # GHC (=> shellcheck) isn't supported on some platforms (such as risc-v)
# but we still want to use writeShellApplication on those platforms # but we still want to use writeShellApplication on those platforms
let let
shellcheckSupported = lib.meta.availableOn stdenv.buildPlatform shellcheck.compiler; shellcheckSupported = lib.meta.availableOn stdenv.buildPlatform shellcheck-minimal.compiler;
excludeOption = lib.optionalString (excludeShellChecks != [ ]) "--exclude '${lib.concatStringsSep "," excludeShellChecks}'"; excludeOption = lib.optionalString (excludeShellChecks != [ ]) "--exclude '${lib.concatStringsSep "," excludeShellChecks}'";
shellcheckCommand = lib.optionalString shellcheckSupported '' shellcheckCommand = lib.optionalString shellcheckSupported ''
# use shellcheck which does not include docs # use shellcheck which does not include docs
# pandoc takes long to build and documentation isn't needed for just running the cli # pandoc takes long to build and documentation isn't needed for just running the cli
${lib.getExe (haskell.lib.compose.justStaticExecutables shellcheck.unwrapped)} ${excludeOption} "$target" ${lib.getExe shellcheck-minimal} ${excludeOption} "$target"
''; '';
in in
if checkPhase == null then '' if checkPhase == null then ''

View File

@ -20088,6 +20088,12 @@ with pkgs;
inherit (__splicedPackages.haskellPackages) ShellCheck; inherit (__splicedPackages.haskellPackages) ShellCheck;
}; };
# Minimal shellcheck executable for package checks.
# Use shellcheck which does not include docs, as
# pandoc takes long to build and documentation isn't needed for just running the cli
shellcheck-minimal = haskell.lib.compose.justStaticExecutables shellcheck.unwrapped;
shellharden = callPackage ../development/tools/shellharden { }; shellharden = callPackage ../development/tools/shellharden { };
schemaspy = callPackage ../development/tools/database/schemaspy { }; schemaspy = callPackage ../development/tools/database/schemaspy { };

View File

@ -110,8 +110,8 @@ let
trivialBuilders = self: super: trivialBuilders = self: super:
import ../build-support/trivial-builders { import ../build-support/trivial-builders {
inherit lib; inherit lib;
inherit (self) runtimeShell stdenv stdenvNoCC haskell; inherit (self) runtimeShell stdenv stdenvNoCC;
inherit (self.pkgsBuildHost) shellcheck; inherit (self.pkgsBuildHost) shellcheck-minimal;
inherit (self.pkgsBuildHost.xorg) lndir; inherit (self.pkgsBuildHost.xorg) lndir;
}; };