Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,28 @@ jobs:
if: always()
run: Remove-Item -Path "${{ env.CARGO_HOME }}/config.toml" -Force

nix:
timeout-minutes: 120
strategy:
matrix:
system:
- os: macOS
runner: self-hosted
sandbox: false
- os: Linux
runner: buildjet-16vcpu-ubuntu-2204
sandbox: true
if: github.repository_owner == 'zed-industries'
runs-on: ${{ matrix.system.runner }}
name: (${{ matrix.system.os }}) Build Nix package
steps:
- name: Checkout repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Setup nix
uses: samueldr/lix-gha-installer-action@54a4026004084aa2cf8d18335cc01b06a2e53b74 # v2025-01-21.prerelease
- name: Build Zed
run: nix build .#zed-editor.debug --option sandbox ${{ matrix.system.sandbox }}

bundle-mac:
timeout-minutes: 120
name: Create a macOS bundle
Expand Down
88 changes: 57 additions & 31 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 17 additions & 53 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,65 +3,29 @@

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
systems.url = "github:nix-systems/default";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
crane.url = "github:ipetkov/crane";
flake-compat.url = "github:edolstra/flake-compat";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs =
{
nixpkgs,
rust-overlay,
crane,
...
}:
let
systems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
{ flake-parts, ... }@inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = import inputs.systems;
imports = [
./nix/overlays.nix
./nix/package.nix
./nix/shell.nix
./nix/treefmt.nix
];

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));
in
{
packages = forAllSystems (pkgs: {
zed-editor = pkgs.zed-editor;
default = pkgs.zed-editor;
});

devShells = forAllSystems (pkgs: {
default = import ./nix/shell.nix { inherit pkgs; };
});

formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);

overlays = overlays // {
default = nixpkgs.lib.composeManyExtensions (builtins.attrValues overlays);
};
};
}
Loading
Loading