nix: Use flake-parts, partitions, and treefmt-nix#45321
nix: Use flake-parts, partitions, and treefmt-nix#45321kubkon merged 9 commits intozed-industries:mainfrom
Conversation
|
We require contributors to sign our Contributor License Agreement, and we don't have @doprz on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
a150599 to
afb16d2
Compare
|
There seems to be a mismatch between It seems that these commands differ even if the
Update: I was able to resolve this by creating edition = "2024"
style_edition = "2024" |
|
This PR is now complete and ready for review! |
5d14609 to
79a1b72
Compare
|
I'm also considering using crate2nix rather than crane as it can:
However, it uses import from derivation (IFD) which can disable build parallelism. Open to thoughts on this issue. I think it's out of scope for this PR but something we should revisit in the future. |
|
Bump @P1n3appl3 |
|
Sorry for the delay, unfortunately I no longer help maintain Zed. @kubkon should be able to review this. |
Thank you for the update! |
|
this looks amazing, builds are probably going to end up much faster now (for nix users). just a question (or suggestion), wouldn't it also we worth to start regularly building and pushing the release candidates to the nix cache instead of just the nightlies? i'd really like to just plug in zed and have a "stable" and/or "pre" tag (like we have with the nightly branch) and be able to easily update zed to the latest and greatest from github with a simple flake input update. |
Thanks! That is a great idea and also one of my use cases. I run both the a nightly and stable version of Zed but it would be nice to be able to pull a cached release candidate on another Nix machine. Not sure who is in charge of nix-related changes in Zed so that is a question/request geared towards them. |
Previously, the dev shell included `rustup` which caused slow startup times as Nix would build rustup from source (including running its test suite). Additionally, rust tooling (cargo, rustfmt, clippy, rust-analyzer) wasn't properly available in the dev shell. This change: - Removes unnecessary `rustup` dependency significantly improving `nix develop` startup time - Directly includes `rustToolchain` from rust-overlay in packages - Provides cargo, rustc, and all rust-toolchain.toml components
79a1b72 to
afeef2c
Compare
|
I think this broke my Now though, it's failing to find it and giving me 400+ errors in weird places like the editor tests where it's resolving the |
Release Notes: Refactored: - Use [flake-parts](https://flake.parts/index.html) modules - `nix/shell.nix` -> `nix/modules/devshells.nix` Added: - Use [flake-parts.partitions](https://flake.parts/options/flake-parts-partitions.html) to isolate dev dependencies so that flakes that use `zed-editor` don't fetch dev-only inputs such as `treefmt-nix` - [treefmt-nix](https://github.com/numtide/treefmt-nix) - nixfmt - rustfmt Fixed: - `shell.nix` and `default.nix` fetching `flake-compat` from `flake.lock` which added an extra and unnecessary input/dependency to `flake.nix`. Fixed by setting a fixed rev and sha256 instead. - `nixfmt-rfc-style` is deprecated and is now `nixfmt` - Fixes zed-industries#45338 by using rust-overlay toolchain directly - Previously, the devShell included `rustup` which caused slow startup times as Nix would build rustup from source (including running its test suite). Additionally, rust tooling (cargo, rustfmt, clippy, rust-analyzer) wasn't available in the dev shell. - cargo, rustc, and rust-toolchain.toml components included in `rustToolchain` Chore: - Update `flake.lock` - Format Rust code with `rustfmt` via `treefmt-nix` --------- Co-authored-by: Jakub Konka <kubkon@jakubkonka.com>
Hi @zed-industries team! Thank you for building such an amazing editor.
Zedhas become my daily driver and a key part of my development workflow. I really like the performance, vim-support, and collaboration features. Excited to make my first contribution! 🚀Release Notes:
Refactored:
nix/shell.nix->nix/modules/devshells.nixAdded:
zed-editordon't fetch dev-only inputs such astreefmt-nixFixed:
shell.nixanddefault.nixfetchingflake-compatfromflake.lockwhich added an extra and unnecessary input/dependency toflake.nix. Fixed by setting a fixed rev and sha256 instead.nixfmt-rfc-styleis deprecated and is nownixfmtrustupwhich caused slow startuptimes as Nix would build rustup from source (including running its test
suite). Additionally, rust tooling (cargo, rustfmt, clippy, rust-analyzer) wasn't available in the dev shell.
rustToolchainChore:
flake.lockrustfmtviatreefmt-nix