feat: rust project initialization
This commit is contained in:
21
nix/package.nix
Normal file
21
nix/package.nix
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
pkgs,
|
||||
rustPlatform,
|
||||
...
|
||||
}: let
|
||||
cargoToml = builtins.fromTOML (builtins.readFile ../Cargo.toml);
|
||||
name = cargoToml.package.name;
|
||||
version = cargoToml.package.version;
|
||||
rustBuild = rustPlatform.buildRustPackage {
|
||||
pname = name;
|
||||
inherit version;
|
||||
src = ../.;
|
||||
cargoLock.lockFile = ../Cargo.lock;
|
||||
};
|
||||
settingsDir = pkgs.runCommand "settings" {} ''
|
||||
mkdir -p $out/settings
|
||||
cp ${../settings}/*.yaml $out/settings/
|
||||
'';
|
||||
in {
|
||||
jj-mcp = rustBuild;
|
||||
}
|
||||
11
nix/rust-version.nix
Normal file
11
nix/rust-version.nix
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
rust-overlay,
|
||||
inputs,
|
||||
system,
|
||||
...
|
||||
}: let
|
||||
overlays = [(import rust-overlay)];
|
||||
in rec {
|
||||
pkgs = import inputs.nixpkgs {inherit system overlays;};
|
||||
version = pkgs.rust-bin.stable.latest.default;
|
||||
}
|
||||
49
nix/shell.nix
Normal file
49
nix/shell.nix
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
inputs,
|
||||
pkgs,
|
||||
self,
|
||||
rustVersion,
|
||||
system,
|
||||
...
|
||||
}:
|
||||
inputs.devenv.lib.mkShell {
|
||||
inherit inputs pkgs;
|
||||
modules = [
|
||||
{
|
||||
packages = with pkgs; [
|
||||
(rustVersion.override {
|
||||
extensions = [
|
||||
"clippy"
|
||||
"rust-src"
|
||||
"rust-analyzer"
|
||||
"rustfmt"
|
||||
];
|
||||
})
|
||||
bacon
|
||||
cargo-deny
|
||||
cargo-edit
|
||||
cargo-shuttle
|
||||
cargo-tarpaulin
|
||||
just
|
||||
marksman # Markdown LSP server
|
||||
tombi # TOML LSP server
|
||||
];
|
||||
|
||||
processes.run.exec = "bacon run";
|
||||
|
||||
enterShell = ''
|
||||
echo "🦀 Rust MCP development environment loaded!"
|
||||
echo "📦 Rust version: $(rustc --version)"
|
||||
echo "📦 Cargo version: $(cargo --version)"
|
||||
echo ""
|
||||
echo "Available tools:"
|
||||
echo " - rust-analyzer (LSP)"
|
||||
echo " - clippy (linter)"
|
||||
echo " - rustfmt (formatter)"
|
||||
echo " - bacon (continuous testing/linting)"
|
||||
echo " - cargo-deny (dependency checker)"
|
||||
echo " - cargo-tarpaulin (code coverage)"
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user