at master 74 lines 1.9 kB view raw
1{ 2 lib, 3 swiftPackages, 4 swift, 5 swiftpm, 6 swiftpm2nix, 7 fetchFromGitHub, 8 versionCheckHook, 9 nix-update-script, 10}: 11 12let 13 # Pass the generated files to the helper. 14 generated = swiftpm2nix.helpers ./nix; 15in 16 17swiftPackages.stdenv.mkDerivation (finalAttrs: { 18 pname = "xcodegen"; 19 version = "2.42.0"; 20 21 src = fetchFromGitHub { 22 owner = "yonaskolb"; 23 repo = "XcodeGen"; 24 tag = finalAttrs.version; 25 hash = "sha256-wcjmADG+XnS2kR8BHe6ijApomucS9Tx7ZRjWZmTCUiI="; 26 }; 27 28 # Including SwiftPM as a nativeBuildInput provides a buildPhase for you. 29 # This by default performs a release build using SwiftPM, essentially: 30 # swift build -c release 31 nativeBuildInputs = [ 32 swift 33 swiftpm 34 ]; 35 36 buildInputs = [ 37 swiftPackages.XCTest 38 ]; 39 40 # The helper provides a configure snippet that will prepare all dependencies 41 # in the correct place, where SwiftPM expects them. 42 configurePhase = generated.configure + '' 43 # Replace the dependency symlink with a writable copy 44 swiftpmMakeMutable Spectre 45 # Now apply a patch 46 patch -p1 -d .build/checkouts/Spectre -i ${./0001-spectre-xct-record.patch} 47 ''; 48 49 installPhase = '' 50 mkdir -p $out/bin $out/share/xcodegen 51 cp "$(swiftpmBinPath)/${finalAttrs.pname}" $out/bin/ 52 cp -r SettingPresets $out/share/xcodegen/SettingPresets 53 ''; 54 55 nativeInstallCheckInputs = [ 56 versionCheckHook 57 ]; 58 versionCheckProgramArg = "--version"; 59 doInstallCheck = true; 60 61 passthru = { 62 updateScript = nix-update-script { }; 63 }; 64 65 meta = { 66 description = "Swift command line tool for generating your Xcode project"; 67 homepage = "https://github.com/yonaskolb/XcodeGen"; 68 changelog = "https://github.com/XcodeGen/blob/${finalAttrs.version}/CHANGELOG.md"; 69 license = lib.licenses.mit; 70 platforms = lib.platforms.darwin; 71 maintainers = [ lib.maintainers.samasaur ]; 72 mainProgram = "xcodegen"; 73 }; 74})