shell.nix

 1{
 2  mkShell,
 3  makeFontsConf,
 4
 5  zed-editor,
 6
 7  rust-analyzer,
 8  cargo-nextest,
 9  nixfmt-rfc-style,
10  protobuf,
11  nodejs_22,
12}:
13(mkShell.override { inherit (zed-editor) stdenv; }) {
14  inputsFrom = [ zed-editor ];
15  packages = [
16    rust-analyzer
17    cargo-nextest
18    nixfmt-rfc-style
19    # TODO: package protobuf-language-server for editing zed.proto
20    # TODO: add other tools used in our scripts
21
22    # `build.nix` adds this to the `zed-editor` wrapper (see `postFixup`)
23    # we'll just put it on `$PATH`:
24    nodejs_22
25  ];
26
27  env =
28    let
29      baseEnvs =
30        (zed-editor.overrideAttrs (attrs: {
31          passthru = { inherit (attrs) env; };
32        })).env; # exfil `env`; it's not in drvAttrs
33    in
34    (removeAttrs baseEnvs [
35      "LK_CUSTOM_WEBRTC" # download the staticlib during the build as usual
36      "ZED_UPDATE_EXPLANATION" # allow auto-updates
37      "CARGO_PROFILE" # let you specify the profile
38      "TARGET_DIR"
39    ])
40    // {
41      # note: different than `$FONTCONFIG_FILE` in `build.nix` – this refers to relative paths
42      # outside the nix store instead of to `$src`
43      FONTCONFIG_FILE = makeFontsConf {
44        fontDirectories = [
45          "./assets/fonts/plex-mono"
46          "./assets/fonts/plex-sans"
47        ];
48      };
49      PROTOC = "${protobuf}/bin/protoc";
50    };
51}