writeShellApplication: Prefer lib.getExe over unwrapped ShellChecked

writeShellApplication currently uses the unwrapped (passthru) attribute
which is simply defined as the ShellCheck Haskell package.
Unfortunately the unwrapped version contains everything and the kitchen
sink, while the bin output of the top-level shellcheck package contains
only the static shellcheck executable.
In other words, by using writeShellApplication, currently 3GB of
packages have to be unnecessarily fetched just to run the checkPhase.

$ nix path-info -Sh $(nix build --print-out-paths --no-link nixpkgs#shellcheck.unwrapped)
/nix/store/23x8702b9kqn0r8swah05ky7w5fnh6m2-ShellCheck-0.9.0             3.0G

$ nix path-info -Sh $(nix build --print-out-paths --no-link nixpkgs#shellcheck.bin)
/nix/store/594izb2jz3c57c7hgxfnb6irypnr4575-shellcheck-0.9.0-bin        45.3M

There is no benefit to using shellcheck.unwrapped in this case.
Therefore, replace shellcheck.unwrapped with lib.getExe shellcheck.
This commit is contained in:
Tobias Markus 2023-03-06 18:54:54 +01:00
parent 30343bab54
commit 6d8041b053

View file

@ -341,7 +341,7 @@ rec {
if checkPhase == null then ''
runHook preCheck
${stdenv.shellDryRun} "$target"
${shellcheck.unwrapped}/bin/shellcheck "$target"
${lib.getExe shellcheck} "$target"
runHook postCheck
''
else checkPhase;