From 2009544b44cbcf4d959939a8cd5db07c327511c2 Mon Sep 17 00:00:00 2001 From: Richard Palethorpe Date: Tue, 19 May 2026 18:28:30 +0100 Subject: [PATCH] fix(nix): correct flake src path and add dev shell (#9894) The flake set `src = ./sources;` referencing a non-existent subdirectory, so `nix build` and `nix develop` both failed evaluation. Point `src` at the repo root and refresh `vendorHash` accordingly. Add `devShells.default` with the Go toolchain, protobuf generators, Node.js/bun for the React UI (`make react-ui`), and the linters used by `make lint` (golangci-lint, gofumpt, goimports, staticcheck). Assisted-by: Claude:claude-opus-4-7 Signed-off-by: Richard Palethorpe --- flake.nix | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index f2f7ad08e..02e17e56e 100644 --- a/flake.nix +++ b/flake.nix @@ -19,9 +19,9 @@ pname = "localai"; version = "custom"; - src = ./sources; + src = ./.; proxyVendor = true; - vendorHash = "sha256-MdadwbUc2pwfpC9ScsiIfjGIcAOgcwSm6rt/KNlTIuA="; + vendorHash = "sha256-6f3adjGsoFXlUtXjBDHP4Mv9jKCOK3aeUXprm0EAVO8="; nativeBuildInputs = with pkgs; [ pkg-config cmake gcc protobuf go-protobuf protoc-gen-go protoc-gen-go-grpc @@ -57,5 +57,41 @@ [ -f $out/bin/local-ai ] && mv $out/bin/local-ai $out/bin/localai ''; }; + + devShells.${system}.default = pkgs.mkShell { + packages = with pkgs; [ + # Build toolchain (stdenv already provides gcc) + go + gnumake + pkg-config + cmake + protobuf + go-protobuf + protoc-gen-go + protoc-gen-go-grpc + + # React UI build (core/http/react-ui — `make react-ui`) + nodejs + bun # alternative to npm, used by `make react-ui-docker` + + # Linting / static analysis (see `make lint`) + golangci-lint + gofumpt + gotools # goimports + go-tools # staticcheck + + # Common dev conveniences + git + curl + ]; + + shellHook = '' + echo "LocalAI dev shell: $(go version), node $(node --version)" + echo "Build: make build (Go binary + React UI)" + echo "React UI: make react-ui (npm install && vite build)" + echo "Lint: make lint (only new issues vs master)" + echo " or make lint-all (full baseline)" + ''; + }; }; }