-
-
Save NicholasTD07/5e4dbabe18227391338d950917e1959f to your computer and use it in GitHub Desktop.
carthage.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with (import <nixpkgs> {}); | |
let | |
xcode-wrapper = import ../xcode-wrapper {}; | |
in stdenv.mkDerivation rec { | |
name = "Carthage-${version}"; | |
version = "0.33.0"; | |
buildInputs = [ | |
xcode-wrapper | |
]; | |
src = fetchFromGitHub { | |
owner = "Carthage"; | |
repo = "Carthage"; | |
rev = "c8ac06e106b6b61f907918bfb2b7a5c432de4678"; | |
sha256 = "083rdrqns6dqrh69zqc1g76vhkv7bd1wxqbx44ahi9x1k7hkzmi4"; # How-to: https://github.com/NixOS/nix/issues/1880 | |
fetchSubmodules = true; # submodules https://github.com/NixOS/nixpkgs/issues/27180 | |
}; | |
# buildCommand = '' | |
# echo $(pwd) | |
# ls | |
# export SWIFT_BUILD_FLAGS="--skip-update --configuration release -Xswiftc -suppress-warnings --disable-sandbox -Xswiftc -static-stdlib" | |
# swift package --skip-update resolve | |
# swift build $(SWIFT_BUILD_FLAGS) -Xswiftc -Xcc -Xswiftc -fmodule-map-file=$(PWD)/`find .build/checkouts -name "swift-llbuild.git*"`/products/libllbuild/include/module.modulemap | |
# ''; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with (import <nixpkgs> {}); | |
{ | |
xcode-version ? "10.3", | |
xcode-base-dir ? "/Applications/Xcode.app" | |
}: | |
stdenv.mkDerivation { | |
name = "xcode-wrapper-${xcode-version}"; | |
buildCommand = '' | |
export PATH=$out/bin:$PATH | |
export LD=$CC | |
rm -rf $out/bin | |
mkdir -p $out/bin | |
cd $out/bin | |
ln -s /usr/bin/xcrun | |
ln -s /usr/bin/swift | |
ln -s /usr/bin/xcode-select | |
ln -s /usr/bin/security | |
ln -s /usr/bin/codesign | |
ln -s /usr/bin/plutil | |
ln -s /usr/bin/clang | |
ln -s /usr/bin/lipo | |
ln -s /usr/bin/file | |
ln -s /usr/bin/rev | |
ln -s "${xcode-base-dir}/Contents/Developer/usr/bin/xcodebuild" | |
ln -s "${xcode-base-dir}/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator" | |
ln -s "${xcode-base-dir}/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs" | |
cd - | |
# Check if we have the xcodebuild version that we want | |
if [ -z "$($out/bin/xcodebuild -version | grep -x 'Xcode ${xcode-version}')" ] | |
then | |
echo "We require xcodebuild version: ${xcode-version}" | |
echo | |
echo "Have you installed Xcode yet?" | |
echo | |
exit 1 | |
fi | |
''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment