pinakes/nix/shell.nix
NotAShelf 8e33088458
nix: get rust-src component from rust-overlay
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I47eba6fba279ee61a1147fa39dd6789c6a6a6964
2026-03-06 18:29:20 +03:00

82 lines
2.1 KiB
Nix

{
pkgs,
rust-bin,
# rust-overlay params
extraComponents ? [],
extraTargets ? [],
}: let
inherit (pkgs.rustc) llvmPackages;
in
pkgs.mkShell {
name = "pinakes-dev";
packages = [
pkgs.taplo # TOML formatter
pkgs.lldb # debugger
pkgs.llvm
pkgs.libiconv
# Additional Cargo Tooling
pkgs.cargo-nextest
pkgs.cargo-deny
# Build tools
# 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.
(rust-bin.nightly.latest.default.override {
extensions = ["rustfmt" "rust-src" "rust-analyzer" "clippy" "rust-analyzer"] ++ extraComponents;
targets =
[
"wasm32-unknown-unknown" # web
]
++ extraTargets;
})
# Link with Clang & lld
pkgs.clang
pkgs.lld
# Handy CLI for packaging Dioxus apps and such
pkgs.dioxus-cli
# Dioxus desktop dependencies (GTK/WebKit)
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
];
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 = "${pkgs.llvm}/bin/llvm-cov";
LLVM_PROFDATA = "${pkgs.llvm}/bin/llvm-profdata";
# Runtime library path for GTK/WebKit/xdotool
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath [
pkgs.xdotool
pkgs.gtk3
pkgs.webkitgtk_4_1
pkgs.glib
pkgs.cairo
pkgs.pango
pkgs.gdk-pixbuf
pkgs.atk
pkgs.libsoup_3
pkgs.openssl
pkgs.kdePackages.wayland
]}";
};
}