From 6d8041b0532c8b51a93f68c9737feecbb195d32a Mon Sep 17 00:00:00 2001 From: Tobias Markus Date: Mon, 6 Mar 2023 18:54:54 +0100 Subject: [PATCH] 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. --- pkgs/build-support/trivial-builders.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/build-support/trivial-builders.nix b/pkgs/build-support/trivial-builders.nix index 7318d13f6bab..8f207e361dd6 100644 --- a/pkgs/build-support/trivial-builders.nix +++ b/pkgs/build-support/trivial-builders.nix @@ -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;