add structural aspects to repo

This commit is contained in:
Emil Lerch 2025-09-09 14:08:57 -07:00
parent c7a9808052
commit 17020ec40a
Signed by: lobo
GPG key ID: A7B62D657EF764F8
5 changed files with 49 additions and 3 deletions

View file

@ -1,3 +1,11 @@
[tools]
zig = "0.15.1"
zls = "0.15.0"
pre-commit = "latest"
"ubi:DonIsaac/zlint" = "latest"
[hooks]
enter = 'echo use "nix develop" if you want to build'
[settings]
experimental = true

30
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,30 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/batmac/pre-commit-zig
rev: v0.3.0
hooks:
- id: zig-fmt
- id: zig-build
- repo: local
hooks:
- id: test
name: Run zig build test
entry: zig
args: ["build", "test"]
language: system
types: [file]
pass_filenames: false
- id: zlint
name: Run zlint
entry: zlint
args: ["--deny-warnings", "--fix"]
language: system
types: [zig]

View file

@ -8,7 +8,11 @@ pub fn build(b: *std.Build) void {
const zlib_dep = b.dependency("zlib", .{
.target = target,
.optimize = optimize,
.optimize = .ReleaseFast,
});
const sdl_dep = b.dependency("SDL", .{
.target = target,
.optimize = .ReleaseFast,
});
// We need to use curl for this as the domain doesn't work with zig TLS
const model_step = ModelDownloadStep.create(b);
@ -35,6 +39,7 @@ pub fn build(b: *std.Build) void {
exe.addIncludePath(vosk_dep.path(""));
exe.addLibraryPath(vosk_dep.path(""));
exe.linkLibrary(zlib_dep.artifact("z"));
exe.linkLibrary(sdl_dep.artifact("SDL2"));
exe.linkSystemLibrary("vosk");
exe.linkSystemLibrary("asound");

View file

@ -12,6 +12,10 @@
.url = "git+https://github.com/allyourcodebase/zlib#61e7df7e996ec5a5f13a653db3c419adb340d6ef",
.hash = "zlib-1.3.1-ZZQ7lbYMAAB1hTSOKSXAKAgHsfDcyWNH_37ojw5WSpgR",
},
.SDL = .{
.url = "git+https://github.com/allyourcodebase/SDL#d29847ebcb6da34dec466a06163431982500a092",
.hash = "SDL-2.32.6-JToi38aTEgECY2mV9iUG7dNouCbarfJ1mkzjjm53gC80",
},
},
.paths = .{
"build.zig",

View file

@ -15,10 +15,9 @@
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
pkg-config
# zlib # handled directly in zig build
alsa-lib
alsa-plugins
SDL2
SDL2 # This exists in AllYourCodeBase, but doesn't do it properly by handling dependencies
];
shellHook = ''