Skip to content

Commit 39e2cfe

Browse files
Do not shadow native toolchain in flake
1 parent ea94439 commit 39e2cfe

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

flake.lock

Lines changed: 2 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
{
22
inputs = {
33
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
4-
systems.url = "github:nix-systems/default";
5-
flake-utils = {
6-
url = "github:numtide/flake-utils";
7-
inputs.systems.follows = "systems";
8-
};
4+
flake-utils.url = "github:numtide/flake-utils";
95
};
106

117
outputs =
@@ -19,18 +15,34 @@
1915
let
2016
pkgs = nixpkgs.legacyPackages.${system};
2117
in
18+
# This discussion inspired me
19+
# https://discourse.nixos.org/t/best-practices-for-expo-react-native-development-with-devenv/58776/5
20+
#
21+
# What we want to do here is just provision the listed packages below,
22+
# without the clang compiler nor Apple SDK.
23+
# So we need to undo some side effects of mkShellNoCC.
2224
{
23-
devShells.default = pkgs.mkShell {
25+
# Use mkShellNoCC instead of mkShell so that it wont pull in clang.
26+
# We need to use the clang from Xcode.
27+
devShells.default = pkgs.mkShellNoCC {
2428
packages = [
2529
# 20.18.1
2630
pkgs.nodejs_20
2731
# 3.3.6
2832
pkgs.ruby_3_3
29-
# 1.16.2
30-
pkgs.cocoapods
3133
# 3.27.1
3234
pkgs.flutter327
3335
];
36+
# Even we use mkShellNoCC, DEVELOPER_DIR, SDKROOT, MACOSX_DEPLOYMENT_TARGET is still set.
37+
# We undo that.
38+
#
39+
# Also, xcrun from Nix is put in PATH, we want to undo that as well.
40+
shellHook = ''
41+
export PATH=$(echo $PATH | sed "s,${pkgs.xcbuild.xcrun}/bin,,")
42+
unset DEVELOPER_DIR
43+
unset SDKROOT
44+
unset MACOSX_DEPLOYMENT_TARGET
45+
'';
3446
};
3547
}
3648
);

0 commit comments

Comments
 (0)