add nix dev shell and update readme

This commit is contained in:
Daniel Bulant 2025-07-09 21:30:11 +02:00
parent e22fa46dc3
commit 097d15f3ec
No known key found for this signature in database
3 changed files with 35 additions and 3 deletions

9
.envrc Normal file
View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
# the shebang is ignored, but nice for editors
if type -P lorri &>/dev/null; then
eval "$(lorri direnv)"
else
echo 'while direnv evaluated .envrc, could not find the command "lorri" [https://github.com/nix-community/lorri]'
use nix
fi

View file

@ -1,6 +1,6 @@
# convex-macros
[![CI Badge](https://github.com/ragkit/convex-macros/actions/workflows/ci.yml/badge.svg)](https://github.com/ragkit/convex-macros/actions/workflows/ci.yml) [![License Badge](https://img.shields.io/badge/license-MIT-blue)](./LICENSE) [![Crates.io Badge](https://img.shields.io/crates/v/ragkit_convex_macros)](https://crates.io/crates/ragkit_convex_macros)
[![CI Badge](https://github.com/danbulant/convex-macros/actions/workflows/ci.yml/badge.svg)](https://github.com/ragkit/convex-macros/actions/workflows/ci.yml) [![License Badge](https://img.shields.io/badge/license-MIT-blue)](./LICENSE)
Macros to help make Convex in Rust nice
@ -90,13 +90,13 @@ assert_eq!(
| `v.union(...)` | Generated `enum` | |
| `v.object({field: ...})` | Generated `struct` | Field names can't be rust keywords (like `type`) |
| `v.bytes()` | not implemented | |
| `v.array(values)` | not implemented | |
| `v.array(values)` | `Vec<T>` | |
| `v.any()` | not implemented | |
## Limitations
- This is experimental and may not be "production quality", use with caution.
- `v.bytes()`, `v.array()`, `v.any()` are not yet supported.
- `v.bytes()`, `v.any()` are not yet supported.
- Field names must be valid Rust identifiers, so keywords like `type` cannot be a field name. Map it to `_type`, `kind`, `t`, etc.
- Union variant names are always named like: `Variant1`, `Variant2`, etc.
- The first acceptable union branch will be used if there are multiples that could validly parse data.

23
shell.nix Normal file
View file

@ -0,0 +1,23 @@
{ pkgs ? import <nixpkgs> {} }:
let
# rust-rover things
fenix = import (fetchTarball "https://github.com/nix-community/fenix/archive/main.tar.gz") { };
rust-toolchain =
fenix.default.toolchain;
in
pkgs.mkShell rec {
buildInputs = with pkgs;[
openssl
pkg-config
cmake
zlib
rust-toolchain
];
nativeBuildInputs = with pkgs; [
pkg-config
];
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath buildInputs}";
OPENSSL_DIR="${pkgs.openssl.dev}";
OPENSSL_LIB_DIR="${pkgs.openssl.out}/lib";
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
}