{ pkgs, shell-library, ... }: { makeShellScriptWithLibrary = { dependencies, name, script, ... }: pkgs.runCommandLocal name { nativeBuildInputs = [pkgs.makeWrapper] ++ dependencies; } '' 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 dependencies} ''; 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}" ''; }