{ pkgs, shell-library, ... }: let shellLibraryDeps = builtins.attrValues {inherit (pkgs) mktemp;}; in { makeShellScriptWithLibrary = { dependencies, name, script, ... }: let shellDependencies = dependencies ++ shellLibraryDeps; in pkgs.runCommandLocal name { nativeBuildInputs = [pkgs.makeWrapper] ++ shellDependencies; } '' install -m755 ${script} -D "$out/bin/${name}" sed -i 's|%SHELL_LIBRARY_PATH|${shell-library}/lib|' "$out/bin/${name}" patchShebangs "$out/bin/${name}" wrapProgram "$out/bin/${name}" --set PATH ${pkgs.lib.makeBinPath shellDependencies} ''; makeShellScriptWithLibraryUnwrapped = { name, script, ... }: pkgs.runCommandLocal name { nativeBuildInputs = []; } '' install -m755 ${script} -D "$out/bin/${name}" sed -i 's|%SHELL_LIBRARY_PATH|${shell-library}/lib|' "$out/bin/${name}" patchShebangs "$out/bin/${name}" ''; }