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
19 # Musl cross-compiler for building remote_server
20 muslCross = pkgs.pkgsCross.musl64;
21 in
22 {
23 devShells.default = (pkgs.mkShell.override { inherit (zed-editor) stdenv; }) {
24 name = "zed-editor-dev";
25 inputsFrom = [ zed-editor ];
26
27 packages = with pkgs; [
28 rustToolchain # cargo, rustc, and rust-toolchain.toml components included
29 cargo-nextest
30 cargo-hakari
31 cargo-machete
32 cargo-zigbuild
33 # TODO: package protobuf-language-server for editing zed.proto
34 # TODO: add other tools used in our scripts
35
36 # `build.nix` adds this to the `zed-editor` wrapper (see `postFixup`)
37 # we'll just put it on `$PATH`:
38 nodejs_22
39 zig
40 ];
41
42 env =
43 (removeAttrs baseEnv [
44 "LK_CUSTOM_WEBRTC" # download the staticlib during the build as usual
45 "ZED_UPDATE_EXPLANATION" # allow auto-updates
46 "CARGO_PROFILE" # let you specify the profile
47 "TARGET_DIR"
48 ])
49 // {
50 # note: different than `$FONTCONFIG_FILE` in `build.nix` – this refers to relative paths
51 # outside the nix store instead of to `$src`
52 FONTCONFIG_FILE = pkgs.makeFontsConf {
53 fontDirectories = [
54 "./assets/fonts/lilex"
55 "./assets/fonts/ibm-plex-sans"
56 ];
57 };
58 PROTOC = "${pkgs.protobuf}/bin/protoc";
59 ZED_ZSTD_MUSL_LIB = "${pkgs.pkgsCross.musl64.pkgsStatic.zstd.out}/lib";
60 # For aws-lc-sys musl cross-compilation
61 CC_x86_64_unknown_linux_musl = "${muslCross.stdenv.cc}/bin/x86_64-unknown-linux-musl-gcc";
62 };
63 };
64 };
65}