1{ inputs, ... }:
2{
3 perSystem =
4 { pkgs, ... }:
5 let
6 # NOTE: Duplicated because this is in a separate flake-parts partition
7 # than ./packages.nix
8 mkZed = import ../toolchain.nix { inherit inputs; };
9 zed-editor = mkZed pkgs;
10
11 rustBin = inputs.rust-overlay.lib.mkRustBin { } pkgs;
12 rustToolchain = rustBin.fromRustupToolchainFile ../../rust-toolchain.toml;
13
14 baseEnv =
15 (zed-editor.overrideAttrs (attrs: {
16 passthru.env = attrs.env;
17 })).env; # exfil `env`; it's not in drvAttrs
18 in
19 {
20 devShells.default = (pkgs.mkShell.override { inherit (zed-editor) stdenv; }) {
21 name = "zed-editor-dev";
22 inputsFrom = [ zed-editor ];
23
24 packages = with pkgs; [
25 rustToolchain # cargo, rustc, and rust-toolchain.toml components included
26 cargo-nextest
27 cargo-hakari
28 cargo-machete
29 cargo-zigbuild
30 # TODO: package protobuf-language-server for editing zed.proto
31 # TODO: add other tools used in our scripts
32
33 # `build.nix` adds this to the `zed-editor` wrapper (see `postFixup`)
34 # we'll just put it on `$PATH`:
35 nodejs_22
36 zig
37 ];
38
39 env =
40 (removeAttrs baseEnv [
41 "LK_CUSTOM_WEBRTC" # download the staticlib during the build as usual
42 "ZED_UPDATE_EXPLANATION" # allow auto-updates
43 "CARGO_PROFILE" # let you specify the profile
44 "TARGET_DIR"
45 ])
46 // {
47 # note: different than `$FONTCONFIG_FILE` in `build.nix` – this refers to relative paths
48 # outside the nix store instead of to `$src`
49 FONTCONFIG_FILE = pkgs.makeFontsConf {
50 fontDirectories = [
51 "./assets/fonts/lilex"
52 "./assets/fonts/ibm-plex-sans"
53 ];
54 };
55 PROTOC = "${pkgs.protobuf}/bin/protoc";
56 ZED_ZSTD_MUSL_LIB = "${pkgs.pkgsCross.musl64.pkgsStatic.zstd.out}/lib";
57 };
58 };
59 };
60}