Skip to repository content131 lines · 5.1 KB · text
tenant.openagents/omega
No repository description is available.
OpenAgents Git authority 2026-07-28T01:30:50.062Z Public web read
NIP-34 coordinate
30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omegaMaintainersHidden in public view
References2 branches · 1 tag
Read-only clone
git clone https://openagents.com/git/tenant.openagents/omega.gitBrowse files
devshells.nix
1{ inputs, ... }:
2{
3 perSystem =
4 { pkgs, system, ... }:
5 let
6 # NOTE: Duplicated because this is in a separate flake-parts partition
7 # than ./packages.nix
8 mkZed = import ../toolchain.nix { inherit inputs; };
9 zed-editor = mkZed pkgs;
10
11 # mdBook pinned to 0.4.40 via a dedicated nixpkgs input, because the docs
12 # rely on behavior that newer mdBook releases break (see
13 # `crates/docs_preprocessor/Cargo.toml`).
14 mdbook = (import inputs.nixpkgs-mdbook { inherit system; }).mdbook;
15
16 # Prebuilt docs preprocessor/postprocessor binary. `docs/book.toml`
17 # defaults to `cargo run -p docs_preprocessor` so non-Nix contributors are
18 # unaffected; in the devshell we point mdBook at this prebuilt binary via
19 # the `MDBOOK_*` env vars below so `mdbook build docs` doesn't have to
20 # compile the preprocessor on every run.
21 #
22 # We reuse `zed-editor`'s crane builder and shared arguments (exposed via
23 # `passthru`) rather than `overrideAttrs`, because crane bakes
24 # `cargoExtraArgs` into the build command at evaluation time.
25 docs-preprocessor = zed-editor.passthru.craneLib.buildPackage (
26 zed-editor.passthru.commonArgs
27 // {
28 inherit (zed-editor.passthru) cargoArtifacts;
29 pname = "zed-docs-preprocessor";
30 cargoExtraArgs = "-p docs_preprocessor --locked";
31 dontUseCmakeConfigure = true;
32 meta = {
33 description = "mdBook preprocessor and postprocessor for the Zed docs";
34 mainProgram = "docs_preprocessor";
35 };
36 }
37 );
38
39 rustBin = inputs.rust-overlay.lib.mkRustBin { } pkgs;
40 rustToolchain = rustBin.fromRustupToolchainFile ../../rust-toolchain.toml;
41
42 baseEnv =
43 (zed-editor.overrideAttrs (attrs: {
44 passthru.env = attrs.env;
45 })).env; # exfil `env`; it's not in drvAttrs
46
47 # Musl cross-compiler for building remote_server
48 muslCross = pkgs.pkgsCross.musl64;
49
50 # Cargo build timings wrapper script
51 wrappedCargo = pkgs.writeShellApplication {
52 name = "cargo";
53 runtimeInputs = [ pkgs.nodejs ];
54 text =
55 let
56 pathToCargoScript = ./. + "/../../script/cargo";
57 in
58 ''
59 NIX_WRAPPER=1 CARGO=${rustToolchain}/bin/cargo ${pathToCargoScript} "$@"
60 '';
61 };
62 in
63 {
64 devShells.default = (pkgs.mkShell.override { inherit (zed-editor) stdenv; }) {
65 name = "zed-editor-dev";
66 inputsFrom = [ zed-editor ];
67
68 packages =
69 with pkgs;
70 [
71 wrappedCargo # must be first, to shadow the `cargo` provided by `rustToolchain`
72 rustToolchain # cargo, rustc, and rust-toolchain.toml components included
73 cargo-nextest
74 cargo-hakari
75 cargo-machete
76 cargo-zigbuild
77 # TODO: package protobuf-language-server for editing zed.proto
78 # TODO: add other tools used in our scripts
79
80 # `build.nix` adds this to the `zed-editor` wrapper (see `postFixup`)
81 # we'll just put it on `$PATH`:
82 nodejs_22
83 zig
84
85 # Documentation tooling: `nix develop -c mdbook build docs`
86 mdbook
87 docs-preprocessor
88
89 # A11y testing infra
90 gobject-introspection
91 at-spi2-core
92 (python3.withPackages (ps: [
93 ps.pyatspi
94 ps.pygobject3
95 ]))
96 ]
97 ++ lib.optionals stdenv.hostPlatform.isLinux [ accerciser ];
98
99 env =
100 (removeAttrs baseEnv [
101 "LK_CUSTOM_WEBRTC" # download the staticlib during the build as usual
102 "ZED_UPDATE_EXPLANATION" # allow auto-updates
103 "CARGO_PROFILE" # let you specify the profile
104 "TARGET_DIR"
105 ])
106 // {
107 # note: different than `$FONTCONFIG_FILE` in `build.nix` – this refers to relative paths
108 # outside the nix store instead of to `$src`
109 FONTCONFIG_FILE = pkgs.makeFontsConf {
110 fontDirectories = [
111 "./assets/fonts/lilex"
112 "./assets/fonts/ibm-plex-sans"
113 ];
114 };
115 PROTOC = "${pkgs.protobuf}/bin/protoc";
116
117 # Point mdBook at the prebuilt preprocessor/postprocessor binary
118 # instead of `cargo run`. mdBook lowercases these keys and turns `_`
119 # into `-`, so they map to `preprocessor.zed-docs-preprocessor.command`
120 # and `output.zed-html.command` in `docs/book.toml`.
121 MDBOOK_PREPROCESSOR__ZED_DOCS_PREPROCESSOR__COMMAND = "${docs-preprocessor}/bin/docs_preprocessor";
122 MDBOOK_OUTPUT__ZED_HTML__COMMAND = "${docs-preprocessor}/bin/docs_preprocessor postprocess";
123
124 ZED_ZSTD_MUSL_LIB = "${pkgs.pkgsCross.musl64.pkgsStatic.zstd.out}/lib";
125 # For aws-lc-sys musl cross-compilation
126 CC_x86_64_unknown_linux_musl = "${muslCross.stdenv.cc}/bin/x86_64-unknown-linux-musl-gcc";
127 };
128 };
129 };
130}
131