Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at netboot-syslinux-multiplatform 39 lines 1.0 kB view raw
1{ writeScriptBin, lib, ... }: 2 3let 4 pListText = lib.generators.toPlist { } { 5 CFBundleDevelopmentRegion = "English"; 6 CFBundleExecutable = "$name"; 7 CFBundleIconFile = "$icon"; 8 CFBundleIconFiles = [ "$icon" ]; 9 CFBundleIdentifier = "org.nixos.$name"; 10 CFBundleInfoDictionaryVersion = "6.0"; 11 CFBundleName = "$name"; 12 CFBundlePackageType = "APPL"; 13 CFBundleSignature = "???"; 14 }; 15in writeScriptBin "write-darwin-bundle" '' 16 shopt -s nullglob 17 18 readonly prefix=$1 19 readonly name=$2 20 readonly exec=$3 21 readonly icon=$4.icns 22 readonly squircle=''${5:-1} 23 readonly plist=$prefix/Applications/$name.app/Contents/Info.plist 24 25 cat > "$plist" <<EOF 26${pListText} 27EOF 28 29 if [[ $squircle == 0 || $squircle == "false" ]]; then 30 sed '/CFBundleIconFiles/,\|</array>|d' -i "$plist" 31 fi 32 33 cat > "$prefix/Applications/$name.app/Contents/MacOS/$name" <<EOF 34#!/bin/bash 35exec $prefix/bin/$exec 36EOF 37 38 chmod +x "$prefix/Applications/$name.app/Contents/MacOS/$name" 39''