Skip to content

Commit

Permalink
flake/readme: update instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
Cloudef committed Jul 23, 2024
1 parent be6b26b commit 14590da
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,21 @@ fn onRequest(arena: *std.heap.ArenaAllocator, request: Request) !void {

## Depend

`build.zig.zon`
Run the following command in zig project root directory.

```sh
zig fetch --save git+https://github.com/Cloudef/zig-router.git
```

In `build.zig` file add the following for whichever modules `zig-router` is required.

```zig
.zig_router = .{
.url = "https://github.com/Cloudef/zig-router/archive/{COMMIT}.tar.gz",
.hash = "{HASH}",
},
const zig_router = b.dependency("zig-router", .{});
exe.root_module.addImport("zig-router", zig_router.module("zig-router"));
```

`build.zig`
You can now import the `zig-router` from zig code.

```zig
const zig_router = b.dependency("zig_router", .{}).module("zig-router");
exe.root_module.addImport("zig-router", zig_router);
const router = @import("zig-router");
```
21 changes: 13 additions & 8 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,23 @@
## Depend
`build.zig.zon`
Run the following command in zig project root directory.
```sh
zig fetch --save git+https://github.com/Cloudef/zig-router.git
```
In `build.zig` file add the following for whichever modules `zig-router` is required.
```zig
.zig_router = .{
.url = "https://github.com/Cloudef/zig-router/archive/{COMMIT}.tar.gz",
.hash = "{HASH}",
},
const zig_router = b.dependency("zig-router", .{});
exe.root_module.addImport("zig-router", zig_router.module("zig-router"));
```
`build.zig`
You can now import the `zig-router` from zig code.
```zig
const zig_router = b.dependency("zig_router", .{}).module("zig-router");
exe.root_module.addImport("zig-router", zig_router);
const router = @import("zig-router");
```
EOF
'');
Expand Down

0 comments on commit 14590da

Please sign in to comment.