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 <io@richiejp.com>
This commit is contained in:
Richard Palethorpe
2026-05-19 18:28:30 +01:00
committed by GitHub
parent e859345b12
commit 2009544b44

View File

@@ -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)"
'';
};
};
}