1{
2 description = "High-performance, multiplayer code editor from the creators of Atom and Tree-sitter";
3
4 inputs = {
5 nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
6 fenix = {
7 url = "github:nix-community/fenix";
8 inputs.nixpkgs.follows = "nixpkgs";
9 };
10 crane = {
11 url = "github:ipetkov/crane";
12 inputs.nixpkgs.follows = "nixpkgs";
13 };
14 flake-compat.url = "github:edolstra/flake-compat";
15 };
16
17 outputs = {
18 nixpkgs,
19 crane,
20 fenix,
21 ...
22 }: let
23 forAllSystems = function:
24 nixpkgs.lib.genAttrs [
25 "x86_64-linux"
26 "aarch64-linux"
27 ] (system:
28 function (import nixpkgs {
29 inherit system;
30 overlays = [fenix.overlays.default];
31 }));
32 in {
33 packages = forAllSystems (pkgs: let
34 craneLib = (crane.mkLib pkgs).overrideToolchain (p: p.fenix.stable.toolchain);
35 rustPlatform = pkgs.makeRustPlatform {
36 inherit (pkgs.fenix.stable.toolchain) cargo rustc;
37 };
38 nightlyBuild = pkgs.callPackage ./nix/build.nix {
39 inherit craneLib rustPlatform;
40 };
41 in {
42 zed-editor = nightlyBuild;
43 default = nightlyBuild;
44 });
45
46 devShells = forAllSystems (pkgs: {
47 default = import ./nix/shell.nix {inherit pkgs;};
48 });
49
50 formatter = forAllSystems (pkgs: pkgs.alejandra);
51
52 overlays.default = final: prev: {
53 zed-editor = final.callPackage ./nix/build.nix {
54 craneLib = (crane.mkLib final).overrideToolchain (p: p.fenix.stable.toolchain);
55 rustPlatform = final.makeRustPlatform {
56 inherit (final.fenix.stable.toolchain) cargo rustc;
57 };
58 };
59 };
60 };
61}