Skip to content

Commit

Permalink
fix xenu build in sandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
Feyorsh committed Sep 2, 2024
1 parent 04abba4 commit 4fe896b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion xenu/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
, runCommandLocal
, makeWrapper
, writeShellScriptBin
, debug ? false
}:
let
generated = swiftpm2nix.helpers ./generated;

configuration = "debug";
configuration = if debug then "debug" else "release";

# this is less brittle than it seems because swiftpm is
# open source and all `xcrun` invocations can be audited
Expand All @@ -28,13 +29,17 @@ let
fi
'';

# swiftpm's `--disable-dependency-cache`, `--manifest-cache`, and `--disable-build-manifest-caching` don't really do much
# because there's user-level caching you can't disable (swiftpm will disable it automatically and warn you).
# setting HOME is necessary because we don't have `llvm-module-cache.patch` from nixpkgs's version of swiftc
swift' = let exe = "swift-build"; in lib.getExe' (runCommandLocal exe { nativeBuildInputs = [ makeWrapper ]; }
''
mkdir -p $out/bin
makeWrapper ${swiftpm}/bin/.swift-package-wrapped $out/bin/${exe} \
--argv0 ${exe} \
--add-flags "-c ${configuration}" \
--add-flags "-j $((enableParallelBuilding?NIX_BUILD_CORES:1))" \
--set HOME "$(mktemp -d)" \
--prefix PATH : ${xcrun'}/bin
'') exe;
in
Expand Down

0 comments on commit 4fe896b

Please sign in to comment.