nix: Separate debug output (#27871)

This makes it easier to iterate on the nix flake by adding a package
which builds zed in debug mode rather than release

Release Notes:

- N/A
This commit is contained in:
Julia Ryan 2025-04-01 14:19:10 -07:00 committed by GitHub
parent 2d05537b59
commit 1567967309
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 30 deletions

View File

@ -26,41 +26,30 @@
"aarch64-darwin"
];
overlays = {
rust-overlay = rust-overlay.overlays.default;
rust-toolchain = final: prev: {
rustToolchain = final.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
};
zed-editor = final: prev: {
zed-editor = final.callPackage ./nix/build.nix {
crane = crane.mkLib final;
rustToolchain = final.rustToolchain;
};
};
};
mkPkgs =
system:
import nixpkgs {
inherit system;
overlays = builtins.attrValues overlays;
};
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f (mkPkgs system));
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
mkZed =
pkgs:
let
rustBin = rust-overlay.lib.mkRustBin { } pkgs;
in
{
packages = forAllSystems (pkgs: {
default = pkgs.zed-editor;
pkgs.callPackage ./nix/build.nix {
crane = crane.mkLib pkgs;
rustToolchain = rustBin.fromRustupToolchainFile ./rust-toolchain.toml;
};
in
rec {
packages = forAllSystems (pkgs: rec {
default = mkZed pkgs;
debug = default.override { profile = "dev"; };
});
devShells = forAllSystems (pkgs: {
default = pkgs.callPackage ./nix/shell.nix { };
default = pkgs.callPackage ./nix/shell.nix {
zed-editor = packages.${pkgs.hostPlatform.system}.default;
};
});
formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
overlays = overlays // {
default = nixpkgs.lib.composeManyExtensions (builtins.attrValues overlays);
overlays.default = final: _: {
zed-editor = mkZed final;
};
};

View File

@ -1,5 +1,4 @@
{
lib,
mkShell,
stdenv,
stdenvAdapters,