1{
2 description = "High-performance, multiplayer code editor from the creators of Atom and Tree-sitter";
3
4 inputs = {
5 nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz";
6 rust-overlay = {
7 url = "github:oxalica/rust-overlay";
8 inputs.nixpkgs.follows = "nixpkgs";
9 };
10 crane.url = "github:ipetkov/crane";
11 flake-compat.url = "github:edolstra/flake-compat";
12 };
13
14 outputs =
15 {
16 nixpkgs,
17 rust-overlay,
18 crane,
19 ...
20 }:
21 let
22 systems = [
23 "x86_64-linux"
24 "x86_64-darwin"
25 "aarch64-linux"
26 "aarch64-darwin"
27 ];
28
29 forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
30 mkZed =
31 pkgs:
32 let
33 rustBin = rust-overlay.lib.mkRustBin { } pkgs;
34 in
35 pkgs.callPackage ./nix/build.nix {
36 crane = crane.mkLib pkgs;
37 rustToolchain = rustBin.fromRustupToolchainFile ./rust-toolchain.toml;
38 };
39 in
40 rec {
41 packages = forAllSystems (pkgs: rec {
42 default = mkZed pkgs;
43 debug = default.override { profile = "dev"; };
44 });
45 devShells = forAllSystems (pkgs: {
46 default = pkgs.callPackage ./nix/shell.nix {
47 zed-editor = packages.${pkgs.hostPlatform.system}.default;
48 };
49 });
50 formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
51 overlays.default = final: _: {
52 zed-editor = mkZed final;
53 };
54 };
55
56 nixConfig = {
57 extra-substituters = [
58 "https://zed.cachix.org"
59 "https://cache.garnix.io"
60 ];
61 extra-trusted-public-keys = [
62 "zed.cachix.org-1:/pHQ6dpMsAZk2DiP4WCL0p9YDNKWj2Q5FL20bNmw1cU="
63 "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
64 ];
65 };
66}