1{
2 lib,
3 mkShell,
4 stdenv,
5 stdenvAdapters,
6 makeFontsConf,
7
8 zed-editor,
9
10 rust-analyzer,
11 cargo-nextest,
12 nixfmt-rfc-style,
13 protobuf,
14 nodejs_22,
15}:
16let
17 moldStdenv = stdenvAdapters.useMoldLinker stdenv;
18 mkShell' =
19 if stdenv.hostPlatform.isLinux then mkShell.override { stdenv = moldStdenv; } else mkShell;
20in
21mkShell' {
22 inputsFrom = [ zed-editor ];
23 packages = [
24 rust-analyzer
25 cargo-nextest
26 nixfmt-rfc-style
27 # TODO: package protobuf-language-server for editing zed.proto
28 # TODO: add other tools used in our scripts
29
30 # `build.nix` adds this to the `zed-editor` wrapper (see `postFixup`)
31 # we'll just put it on `$PATH`:
32 nodejs_22
33 ];
34
35 # We set SDKROOT and DEVELOPER_DIR to the Xcode ones instead of the nixpkgs ones, because
36 # we need Swift 6.0 and nixpkgs doesn't have it
37 shellHook = lib.optionalString stdenv.hostPlatform.isDarwin ''
38 export SDKROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk";
39 export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer";
40 '';
41
42 env =
43 let
44 baseEnvs =
45 (zed-editor.overrideAttrs (attrs: {
46 passthru = { inherit (attrs) env; };
47 })).env; # exfil `env`; it's not in drvAttrs
48 in
49 (removeAttrs baseEnvs [
50 "LK_CUSTOM_WEBRTC" # download the staticlib during the build as usual
51 "ZED_UPDATE_EXPLANATION" # allow auto-updates
52 "CARGO_PROFILE" # let you specify the profile
53 "TARGET_DIR"
54 ])
55 // {
56 # note: different than `$FONTCONFIG_FILE` in `build.nix` – this refers to relative paths
57 # outside the nix store instead of to `$src`
58 FONTCONFIG_FILE = makeFontsConf {
59 fontDirectories = [
60 "./assets/fonts/plex-mono"
61 "./assets/fonts/plex-sans"
62 ];
63 };
64 PROTOC = "${protobuf}/bin/protoc";
65 };
66}