feat(nix): remove devenv, build backend with nix

This commit is contained in:
2026-05-10 15:57:12 +02:00
parent aaf82e3a5c
commit fd00d1925b
7 changed files with 93 additions and 310 deletions

24
nix/backend.nix Normal file
View File

@@ -0,0 +1,24 @@
target: let
cargoToml = fromTOML (builtins.readFile ../backend/Cargo.toml);
inherit (cargoToml.package) name version;
pkgs = target.crossPkgs;
buildArgs = {
pname = name;
inherit version;
src = pkgs.lib.cleanSource ../.;
cargoLock.lockFile = ../Cargo.lock;
useNextest = true;
meta = {
inherit (cargoToml.package) description homepage;
};
postBuild = "${pkgs.upx}/bin/upx target/*/release/*${name}";
};
rustVersion = pkgs.rust-bin.stable.latest.default.override {
targets = [target.triple];
};
rustPlatform = target.crossPkgs.makeRustPlatform {
cargo = rustVersion;
rustc = rustVersion;
};
in
rustPlatform.buildRustPackage buildArgs

View File

@@ -1,21 +0,0 @@
{
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;
}

View File

@@ -1,11 +0,0 @@
{
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;
}

View File

@@ -1,58 +1,32 @@
{
inputs,
pkgs,
self,
rustVersion,
system,
...
}:
inputs.devenv.lib.mkShell {
inherit inputs pkgs;
modules = [
{
packages = with pkgs; [
# Backend
(rustVersion.override {
extensions = [
"clippy"
"rust-src"
"rust-analyzer"
"rustfmt"
];
})
bacon
cargo-deny
cargo-edit
cargo-shuttle
cargo-tarpaulin
just
marksman # Markdown LSP server
sqlx-cli
tombi # TOML LSP server
# Frontend
nodejs_24
rustywind # tailwind
nodePackages.prettier
nodePackages.eslint
nodePackages.pnpm
pkgs.mkShell {
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
sqlx-cli
tombi # TOML LSP server
processes.backend-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)"
'';
}
# Frontend
nodejs_24
rustywind # tailwind
prettier
eslint
pnpm
];
}