typioca: 2.7.0 -> 2.8.0
[NixPkgs.git] / pkgs / build-support / make-darwin-bundle / default.nix
blob52dd54b0b2c4d6d91424fd6ccbc070df5422b42d
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"
20     fi
22     ${writeDarwinBundle}/bin/write-darwin-bundle "''${!outputBin}" "${name}" "${exec}"
23   }
25   preDistPhases+=" makeDarwinBundlePhase"
26 '')