zed/flake.nix
jvmncs ff26abdc2f
nix: Fix gpu-lib/wayland binary patching on nix package (#16958)
Also, includes some cleanup -- adds missing flake-compat input and
aligns the nix build module with how nixpkgs does it.

Release Notes:

- Fixed an issue on NixOS package where the wrong binaries were being
patched, leading to missing Wayland libs when launching Zed
2024-08-27 12:24:42 -04:00

62 lines
1.6 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";
};
flake-compat.url = "github:edolstra/flake-compat";
};
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);
rustPlatform = pkgs.makeRustPlatform {
inherit (pkgs.fenix.stable.toolchain) cargo rustc;
};
nightlyBuild = pkgs.callPackage ./nix/build.nix {
inherit craneLib rustPlatform;
};
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);
rustPlatform = final.makeRustPlatform {
inherit (final.fenix.stable.toolchain) cargo rustc;
};
};
};
};
}