Skip to content

Commit

Permalink
nix: modify xcodewrapper from latest nixpkgs
Browse files Browse the repository at this point in the history
  • Loading branch information
siddarthkay committed Jan 16, 2025
1 parent a1160d5 commit f95fafe
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
32 changes: 22 additions & 10 deletions nix/pkgs/xcodeenv/compose-xcodewrapper.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{ stdenv, lib, writeShellScriptBin }:
{ versions ? [ "14.3" "15.1" "15.2" "15.3" ]
, xcodeBaseDir ? "/Applications/Xcode.app" }:

assert stdenv.isDarwin;
{
lib,
stdenv,
writeShellScriptBin,
}:
{
versions ? [ ],
xcodeBaseDir ? "/Applications/Xcode.app",
}:

assert stdenv.hostPlatform.isDarwin;
let
xcodebuildPath = "${xcodeBaseDir}/Contents/Developer/usr/bin/xcodebuild";

Expand All @@ -25,14 +30,22 @@ let
'';
in
stdenv.mkDerivation {
pname = "xcode-wrapper-plus";
version = lib.concatStringsSep "," versions;
name = "xcode-wrapper-impure";
# Fails in sandbox. Use `--option sandbox relaxed` or `--option sandbox false`.
__noChroot = true;
buildCommand = ''
mkdir -p $out/bin
cd $out/bin
ln -s "${xcodebuildWrapper}/bin/xcode-select"
${
if versions == [ ] then
''
ln -s "${xcodebuildPath}"
''
else
''
ln -s "${xcodebuildWrapper}/bin/xcode-select"
''
}
ln -s /usr/bin/security
ln -s /usr/bin/codesign
ln -s /usr/bin/xcrun
Expand All @@ -41,10 +54,9 @@ stdenv.mkDerivation {
ln -s /usr/bin/lipo
ln -s /usr/bin/file
ln -s /usr/bin/rev
ln -s "${xcodebuildWrapper}/bin/xcodebuild"
ln -s "${xcodeBaseDir}/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator"
cd ..
ln -s "${xcodeBaseDir}/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs"
'';
}
}
4 changes: 2 additions & 2 deletions nix/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let

/* Lock requires Xcode verison. */
xcodeWrapper = callPackage ./pkgs/xcodeenv/compose-xcodewrapper.nix { } {
versions = ["14.3" "15.1" "15.2" "15.3" "15.4"];
versions = [ ];
};

/* Gomobile also needs the Xcode wrapper. */
Expand All @@ -27,7 +27,7 @@ in mkShell {
buildInputs = with pkgs; [
git jq which
go golangci-lint go-junit-report gopls go-bindata gomobileMod codecov-cli go-generate-fast
mockgen protobuf3_20 protoc-gen-go gotestsum go-modvendor openjdk
mockgen protobuf3_21 protoc-gen-go gotestsum go-modvendor openjdk
] ++ lib.optionals (stdenv.isDarwin) [ xcodeWrapper ];

shellHook = lib.optionalString (!isMacM1) ''
Expand Down

0 comments on commit f95fafe

Please sign in to comment.