From 097d15f3ec00ce9fe6288d09e13841aeeb466ba2 Mon Sep 17 00:00:00 2001 From: Daniel Bulant Date: Wed, 9 Jul 2025 21:30:11 +0200 Subject: [PATCH] add nix dev shell and update readme --- .envrc | 9 +++++++++ README.md | 6 +++--- shell.nix | 23 +++++++++++++++++++++++ 3 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 .envrc create mode 100644 shell.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..82b2b9e --- /dev/null +++ b/.envrc @@ -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 diff --git a/README.md b/README.md index 040e991..e72306e 100644 --- a/README.md +++ b/README.md @@ -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` | | | `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. diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..02b8b7e --- /dev/null +++ b/shell.nix @@ -0,0 +1,23 @@ +{ pkgs ? import {} }: +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}"; +}