Skip to content

Commit 2009544

Browse files
authored
fix(nix): correct flake src path and add dev shell (mudler#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>
1 parent e859345 commit 2009544

1 file changed

Lines changed: 38 additions & 2 deletions

File tree

flake.nix

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
pname = "localai";
2020
version = "custom";
2121

22-
src = ./sources;
22+
src = ./.;
2323
proxyVendor = true;
24-
vendorHash = "sha256-MdadwbUc2pwfpC9ScsiIfjGIcAOgcwSm6rt/KNlTIuA=";
24+
vendorHash = "sha256-6f3adjGsoFXlUtXjBDHP4Mv9jKCOK3aeUXprm0EAVO8=";
2525

2626
nativeBuildInputs = with pkgs; [
2727
pkg-config cmake gcc protobuf go-protobuf protoc-gen-go protoc-gen-go-grpc
@@ -57,5 +57,41 @@
5757
[ -f $out/bin/local-ai ] && mv $out/bin/local-ai $out/bin/localai
5858
'';
5959
};
60+
61+
devShells.${system}.default = pkgs.mkShell {
62+
packages = with pkgs; [
63+
# Build toolchain (stdenv already provides gcc)
64+
go
65+
gnumake
66+
pkg-config
67+
cmake
68+
protobuf
69+
go-protobuf
70+
protoc-gen-go
71+
protoc-gen-go-grpc
72+
73+
# React UI build (core/http/react-ui — `make react-ui`)
74+
nodejs
75+
bun # alternative to npm, used by `make react-ui-docker`
76+
77+
# Linting / static analysis (see `make lint`)
78+
golangci-lint
79+
gofumpt
80+
gotools # goimports
81+
go-tools # staticcheck
82+
83+
# Common dev conveniences
84+
git
85+
curl
86+
];
87+
88+
shellHook = ''
89+
echo "LocalAI dev shell: $(go version), node $(node --version)"
90+
echo "Build: make build (Go binary + React UI)"
91+
echo "React UI: make react-ui (npm install && vite build)"
92+
echo "Lint: make lint (only new issues vs master)"
93+
echo " or make lint-all (full baseline)"
94+
'';
95+
};
6096
};
6197
}

0 commit comments

Comments
 (0)