nix: cleanup; get rust-analyzer from overlay

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I2bfd563820ce6258798d8f06247e4ffe6a6a6964
This commit is contained in:
raf 2026-02-09 14:34:17 +03:00
commit d6665c73ff
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
2 changed files with 65 additions and 74 deletions

View file

@ -1,5 +1,4 @@
{
description = "Rust Project Template";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
rust-overlay = {
@ -9,27 +8,18 @@
};
outputs = {
self,
nixpkgs,
rust-overlay,
...
}: let
systems = ["x86_64-linux" "aarch64-linux"];
forEachSystem = nixpkgs.lib.genAttrs systems;
pkgsForEach = nixpkgs.legacyPackages;
in {
packages = forEachSystem (system: let
pkgs = pkgsForEach.${system};
in {
mercant = pkgs.callPackage ./nix/packages/mercant.nix {};
webview-sdk = pkgs.callPackage ./nix/packages/webview.nix {};
});
devShells = forEachSystem (system: let
pkgs = nixpkgs.legacyPackages.${system}.extend rust-overlay.overlays.default;
pkgs = pkgsForEach.${system}.extend rust-overlay.overlays.default;
in {
default = pkgs.callPackage ./nix/shell.nix {};
});
hydraJobs = self.packages;
};
}

View file

@ -4,13 +4,14 @@
# rust-overlay params
extraComponents ? [],
extraTargets ? [],
}:
pkgs.mkShell {
name = "mercant-devshell";
}: let
inherit (pkgs.rustc) llvmPackages;
in
pkgs.mkShell {
name = "pinakes-dev";
packages = [
pkgs.taplo # TOML formatter
pkgs.lldb # debugger
pkgs.rust-analyzer-unwrapped # LSP
pkgs.llvm
pkgs.libiconv
@ -23,7 +24,7 @@ pkgs.mkShell {
# 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-analyzer" "clippy"] ++ extraComponents;
extensions = ["rustfmt" "rust-analyzer" "clippy" "rust-analyzer"] ++ extraComponents;
targets =
[
"wasm32-unknown-unknown" # web
@ -55,7 +56,7 @@ pkgs.mkShell {
env = {
# Allow Cargo to use lld and clang properly
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
RUSTFLAGS = "-C link-arg=-fuse-ld=lld";
# 'cargo llvm-cov' reads these environment variables to find these
@ -78,4 +79,4 @@ pkgs.mkShell {
pkgs.kdePackages.wayland
]}";
};
}
}