{ lib, makeWrapper, stdenv }: /* pkg: package - nixpkgs package exe: string - executable (under bin) in pkg wrapperArgs: string[] - arguments to pass to the wrapper */ { pkg, exe ? pkg.meta.mainProgram, wrapperArgs }: lib.hiPrio (stdenv.mkDerivation { inherit wrapperArgs; name = "${pkg.name}-wrap-${exe}"; nativeBuildInputs = [ makeWrapper ]; phases = ["installPhase"]; installPhase = '' mkdir -p $out/bin makeWrapper ${pkg}/bin/${exe} $out/bin/${exe} $wrapperArgs ''; })