shell.nix

 1{
 2  pkgs ? import <nixpkgs> { },
 3}:
 4
 5let
 6  stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.llvmPackages_18.stdenv;
 7in
 8if pkgs.stdenv.isDarwin then
 9  # See https://github.com/NixOS/nixpkgs/issues/320084
10  throw "zed: nix dev-shell isn't supported on darwin yet."
11else
12  (pkgs.mkShell.override { inherit stdenv; }) rec {
13    nativeBuildInputs = with pkgs; [
14      copyDesktopItems
15      curl
16      perl
17      pkg-config
18      protobuf
19      rustPlatform.bindgenHook
20    ];
21
22    buildInputs = with pkgs; [
23      curl
24      fontconfig
25      freetype
26      libgit2
27      openssl
28      sqlite
29      zlib
30      zstd
31
32      alsa-lib
33      libxkbcommon
34      wayland
35      xorg.libxcb
36    ];
37
38    env = {
39      LD_LIBRARY_PATH =
40        with pkgs;
41        lib.makeLibraryPath (
42          buildInputs
43          ++ [
44            stdenv.cc.cc.lib
45            vulkan-loader
46          ]
47        );
48      ZSTD_SYS_USE_PKG_CONFIG = true;
49      FONTCONFIG_FILE = pkgs.makeFontsConf {
50        fontDirectories = [
51          "assets/fonts/zed-mono"
52          "assets/fonts/zed-sans"
53        ];
54      };
55    };
56  }