zed/flake.nix
jvmncs 093f131712
Add zed-editor package and overlay to flake (#16783)
Adds a `zed-editor` package to the flake, along with exported overlay.
Uses [`crane`](https://crane.dev) to avoid issues with updating
git-sourced dependencies' hashes. Crane will also be useful if we want
to export separate packages for `stable`, `preview`, and `nightly` in
the future.

Release Notes:

- Added a default package + overlay to Zed's Nix flake. This is useful
for users wanting to pilot nightly builds of Zed on NixOS.
2024-08-26 11:10:34 -04:00

55 lines
1.3 KiB
Nix

{
description = "High-performance, multiplayer code editor from the creators of Atom and Tree-sitter";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
nixpkgs,
crane,
fenix,
...
}: let
forAllSystems = function:
nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
] (system:
function (import nixpkgs {
inherit system;
overlays = [fenix.overlays.default];
}));
in {
packages = forAllSystems (pkgs: let
craneLib = (crane.mkLib pkgs).overrideToolchain (p: p.fenix.stable.toolchain);
nightlyBuild = pkgs.callPackage ./nix/build.nix {
inherit craneLib;
};
in {
zed-editor = nightlyBuild;
default = nightlyBuild;
});
devShells = forAllSystems (pkgs: {
default = import ./nix/shell.nix {inherit pkgs;};
});
formatter = forAllSystems (pkgs: pkgs.alejandra);
overlays.default = final: _prev: {
zed-editor = final.callPackage ./nix/build.nix {
craneLib = (crane.mkLib final).overrideToolchain (p: p.fenix.stable.toolchain);
};
};
};
}