{ lib, pkgs, rust-bin, }: let inherit (pkgs.rustc) llvmPackages; # Dioxus desktop dependencies (GTK/WebKit) runtimeDeps = [ pkgs.pkg-config pkgs.glib pkgs.gtk3 pkgs.webkitgtk_4_1 pkgs.libsoup_3 pkgs.cairo pkgs.pango pkgs.gdk-pixbuf pkgs.atk pkgs.xdotool # provides libxdo pkgs.openssl pkgs.kdePackages.wayland pkgs.libiconv ]; in pkgs.mkShell { name = "pinakes-dev"; packages = [ # We use the rust-overlay to get the stable Rust toolchain for various targets. # This is not exactly necessary, but it allows for compiling for various targets # with the least amount of friction. The extensions are to make sure all tooling # uses the same Rust version and the general surrounding tooling. (rust-bin.nightly.latest.default.override { extensions = ["rustfmt" "rust-src" "rust-analyzer" "clippy" "rust-analyzer"]; targets = ["wasm32-unknown-unknown" "wasm32-wasip1"]; # web + plugins }) # Modern, LLVM based linking pipeline. Kind of sucks on Windows, though. llvmPackages.lld llvmPackages.clang # CLI helpers pkgs.dioxus-cli # for packaging Dioxus apps and such pkgs.just # general command runner for everything # Additional Cargo Tooling pkgs.cargo-nextest pkgs.cargo-deny # Other tools pkgs.taplo # TOML formatter pkgs.lldb # debugger pkgs.sccache # distributed Rust cache ] ++ runtimeDeps; # We could do this in the NixOS configuration via ~/.config/cargo.toml # or something, but this is better because it lets everyone benefit # from sccache while working with Pinakes. The reason those variables # are not in 'env' are that we have to use Bash, which doesn't mix well # with Nix strings. shellHook = '' if [ -n "$SCCACHE_BIN" ]; then export RUSTC_WRAPPER="$SCCACHE_BIN" export SCCACHE_DIR="''${HOME}/.cache/sccache" export SCCACHE_CACHE_SIZE="50G" mkdir -p "$SCCACHE_DIR" echo "sccache setup complete!" fi # Start the daemon early for slightly faster startup. "$SCCACHE_BIN" --start-server >/dev/null 2>&1 || true ''; env = { # Allow Cargo to use lld and clang properly LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib"; RUSTFLAGS = "-C link-arg=-fuse-ld=lld"; # 'cargo llvm-cov' reads these environment variables to find these # binaries, which are needed to run the tests. LLVM_COV = "${llvmPackages.llvm}/bin/llvm-cov"; LLVM_PROFDATA = "${llvmPackages.llvm}/bin/llvm-profdata"; # Runtime library path for GTK/WebKit/xdotool LD_LIBRARY_PATH = "${lib.makeLibraryPath runtimeDeps}"; # Enable sccache for local nix develop shell SCCACHE_BIN = "${pkgs.sccache}/bin/sccache"; }; }