feat: Expose module for setting up the build and test environment.

This commit is contained in:
Robert Hensing 2025-10-27 01:37:18 +01:00
parent 62d4eb37a2
commit 26b7cb2116
4 changed files with 221 additions and 44 deletions

View file

@ -3,6 +3,39 @@
Use the Nix [C API] from Rust.
## Build with `nix-cargo-integration`
The development environment and building with Nix are taken care of by [nix-cargo-integration](https://github.com/90-008/nix-cargo-integration#readme) ([options](https://flake.parts/options/nix-cargo-integration.html)).
The dependency on Nix is taken care of with the [`nix-bindings-rust` flake-parts module]().
Example usage:
```nix
{
outputs =
inputs@{ self, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; }
{
imports = [
inputs.nix-cargo-integration.flakeModule
inputs.nix-bindings-rust.modules.flake.default
];
perSystem = { config, pkgs, ... }: {
# optional:
nix-bindings-rust.nixPackage = pkgs.nix;
nci.projects."myproject" = {
depsDrvConfig = {
imports = [ config.nix-bindings-rust.nciBuildConfig ];
};
};
};
};
}
```
## Hacking
The following will open a shell with dependencies, and install pre-commit for automatic formatting.