flake.nix

 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
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      nightlyBuild = pkgs.callPackage ./nix/build.nix {
36        inherit craneLib;
37      };
38    in {
39      zed-editor = nightlyBuild;
40      default = nightlyBuild;
41    });
42
43    devShells = forAllSystems (pkgs: {
44      default = import ./nix/shell.nix {inherit pkgs;};
45    });
46
47    formatter = forAllSystems (pkgs: pkgs.alejandra);
48
49    overlays.default = final: _prev: {
50      zed-editor = final.callPackage ./nix/build.nix {
51        craneLib = (crane.mkLib final).overrideToolchain (p: p.fenix.stable.toolchain);
52      };
53    };
54  };
55}