at 24.11-pre 26 lines 899 B view raw
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. 5 6{ lib, writeShellScript, writeDarwinBundle }: 7 8{ name # The name of the Application file. 9, exec # Executable file. 10, icon ? "" # Optional icon file. 11}: 12 13writeShellScript "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" 17 18 if [ -n "${icon}" ]; then 19 ln -s "${icon}" "''${!outputBin}/Applications/${name}.app/Contents/Resources" 20 fi 21 22 ${writeDarwinBundle}/bin/write-darwin-bundle "''${!outputBin}" "${name}" "${exec}" 23 } 24 25 preDistPhases+=" makeDarwinBundlePhase" 26'')