Add known-folders as a flake input

This allows the flake to work without passing in `?submodules=1`, which
makes it easy to include in other flakes.

This commit also makes it possible to override the path to the
`known-folders` package like so:

```
zig build -Dknown-folders=/path/to/known-folders.zig
```

This allows `flake.nix` to pass in the nix store path.
This commit is contained in:
LeRoyce Pearson
2022-07-18 14:35:00 -06:00
parent ac8600cd8c
commit 542f49087e
2 changed files with 28 additions and 4 deletions

View File

@@ -42,7 +42,9 @@ pub fn build(b: *std.build.Builder) !void {
b.option(bool, "enable_tracy_callstack", "Enable callstack graphs.") orelse false,
);
exe.addPackage(.{ .name = "known-folders", .source = .{ .path = "src/known-folders/known-folders.zig" } });
const KNOWN_FOLDERS_DEFAULT_PATH = "src/known-folders/known-folders.zig";
const known_folders_path = b.option([]const u8, "known-folders", "Path to known-folders package (default: " ++ KNOWN_FOLDERS_DEFAULT_PATH ++ ")") orelse KNOWN_FOLDERS_DEFAULT_PATH;
exe.addPackage(.{ .name = "known-folders", .source = .{ .path = known_folders_path } });
if (enable_tracy) {
const client_cpp = "src/tracy/TracyClient.cpp";