From 15679673098f75a7f23a2570461d022f7010bd0b Mon Sep 17 00:00:00 2001 From: Julia Ryan Date: Tue, 1 Apr 2025 14:19:10 -0700 Subject: [PATCH] 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 --- flake.nix | 47 ++++++++++++++++++----------------------------- nix/shell.nix | 1 - 2 files changed, 18 insertions(+), 30 deletions(-) diff --git a/flake.nix b/flake.nix index f3c832b536..834b9aa9f2 100644 --- a/flake.nix +++ b/flake.nix @@ -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; + forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system}); + mkZed = + pkgs: + let + rustBin = rust-overlay.lib.mkRustBin { } pkgs; + in + pkgs.callPackage ./nix/build.nix { + crane = crane.mkLib pkgs; + rustToolchain = rustBin.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)); in - { - packages = forAllSystems (pkgs: { - default = pkgs.zed-editor; + 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; }; }; diff --git a/nix/shell.nix b/nix/shell.nix index 1c80df03e5..b2c410eb89 100644 --- a/nix/shell.nix +++ b/nix/shell.nix @@ -1,5 +1,4 @@ { - lib, mkShell, stdenv, stdenvAdapters,