-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathflake.nix
More file actions
63 lines (61 loc) · 2.14 KB
/
flake.nix
File metadata and controls
63 lines (61 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
nixpkgs,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
# This discussion inspired me
# https://discourse.nixos.org/t/best-practices-for-expo-react-native-development-with-devenv/58776/5
#
# What we want to do here is just provision the listed packages below,
# without the clang compiler nor Apple SDK.
# So we need to undo some side effects of mkShellNoCC.
{
# Use mkShellNoCC instead of mkShell so that it wont pull in clang.
# We need to use the clang from Xcode.
devShells.default = pkgs.mkShellNoCC {
packages = [
# GitHub Actions runner macos-14 uses ruby 3.3.x
# See https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md
pkgs.ruby_3_3
(
let
# GitHub Actions runner macos-14 includes this version of swiftformat.
# See https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md#tools
version = "0.57.2";
in
pkgs.swiftformat.overrideAttrs {
inherit version;
src = pkgs.fetchFromGitHub {
owner = "nicklockwood";
repo = "SwiftFormat";
rev = version;
hash = "sha256-KMSRryaSoAX4zi+AhIEHFMX0UVN8ena27SoJF8gAbzY=";
};
}
)
];
# Even we use mkShellNoCC, DEVELOPER_DIR, SDKROOT, MACOSX_DEPLOYMENT_TARGET is still set.
# We undo that.
#
# Also, xcrun from Nix is put in PATH, we want to undo that as well.
shellHook = ''
export PATH=$(echo $PATH | sed "s,${pkgs.xcbuild.xcrun}/bin,,")
unset DEVELOPER_DIR
unset SDKROOT
unset MACOSX_DEPLOYMENT_TARGET
'';
};
}
);
}