1 # given a package with an executable and an icon, make a darwin bundle for
2 # it. This package should be used when generating launchers for native Darwin
3 # applications. If the package conatins a .desktop file use
4 # `desktopToDarwinLauncher` instead.
6 { lib, writeShellScript, writeDarwinBundle }:
8 { name # The name of the Application file.
9 , exec # Executable file.
10 , icon ? "" # Optional icon file.
13 writeShellScript "make-darwin-bundle-${name}" (''
14 function makeDarwinBundlePhase() {
15 mkdir -p "''${!outputBin}/Applications/${name}.app/Contents/MacOS"
16 mkdir -p "''${!outputBin}/Applications/${name}.app/Contents/Resources"
18 if [ -n "${icon}" ]; then
19 ln -s "${icon}" "''${!outputBin}/Applications/${name}.app/Contents/Resources"
22 ${writeDarwinBundle}/bin/write-darwin-bundle "''${!outputBin}" "${name}" "${exec}"
25 preDistPhases+=" makeDarwinBundlePhase"