zed/nix/shell.nix
jvmncs 2ff8dde925
Use fenix toolchain in nix shell (#18227)
In #17974 we explicitly depend on rustc/cargo for the nix devShell,
however the fenix overlay that contains the latest stable versions was
not being applied to that shell. This led to the shell inheriting
whatever rustc/cargo was on nixos-unstable from nixpkgs, which sometimes
lags behind. This change fixes that, and also restructures the flake to
ensure that all outputs rely on the overlaid `pkgs`.

Release Notes:

- N/A
2024-09-23 10:16:15 -04:00

51 lines
1.1 KiB
Nix

{pkgs ? import <nixpkgs> {}}: let
stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.llvmPackages_18.stdenv;
in
if pkgs.stdenv.isDarwin
then
# See https://github.com/NixOS/nixpkgs/issues/320084
throw "zed: nix dev-shell isn't supported on darwin yet."
else let
buildInputs = with pkgs; [
curl
fontconfig
freetype
libgit2
openssl
sqlite
zlib
zstd
alsa-lib
libxkbcommon
wayland
xorg.libxcb
vulkan-loader
rustToolchain
];
in
pkgs.mkShell.override {inherit stdenv;} {
nativeBuildInputs = with pkgs; [
clang
curl
cmake
perl
pkg-config
protobuf
rustPlatform.bindgenHook
];
inherit buildInputs;
shellHook = ''
export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath buildInputs}:$LD_LIBRARY_PATH"
export PROTOC="${pkgs.protobuf}/bin/protoc"
'';
FONTCONFIG_FILE = pkgs.makeFontsConf {
fontDirectories = [
"./assets/fonts/zed-mono"
"./assets/fonts/zed-sans"
];
};
ZSTD_SYS_USE_PKG_CONFIG = true;
}