Merge remote-tracking branch 'upstream/main' into aanderse/main
This commit is contained in:
commit
7eb94b72f9
26 changed files with 125 additions and 109 deletions
119
Cargo.lock
generated
119
Cargo.lock
generated
|
|
@ -4,9 +4,9 @@ version = 4
|
|||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.1.3"
|
||||
version = "1.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
|
||||
checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
|
@ -42,9 +42,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.9.4"
|
||||
version = "2.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394"
|
||||
checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"
|
||||
|
||||
[[package]]
|
||||
name = "cexpr"
|
||||
|
|
@ -57,9 +57,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.3"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9"
|
||||
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
||||
|
||||
[[package]]
|
||||
name = "clang-sys"
|
||||
|
|
@ -105,7 +105,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.61.1",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -116,14 +116,14 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
|
|||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.3.3"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"
|
||||
checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"r-efi",
|
||||
"wasi",
|
||||
"wasip2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -134,11 +134,11 @@ checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
|
|||
|
||||
[[package]]
|
||||
name = "home"
|
||||
version = "0.5.11"
|
||||
version = "0.5.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf"
|
||||
checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d"
|
||||
dependencies = [
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -164,9 +164,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.176"
|
||||
version = "0.2.180"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174"
|
||||
checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc"
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
|
|
@ -192,9 +192,9 @@ checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039"
|
|||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.28"
|
||||
version = "0.4.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
|
||||
checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
|
|
@ -208,14 +208,6 @@ version = "0.2.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
||||
|
||||
[[package]]
|
||||
name = "nix-bindings-bindgen-raw"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix-bindings-expr"
|
||||
version = "0.1.0"
|
||||
|
|
@ -224,9 +216,9 @@ dependencies = [
|
|||
"cstr",
|
||||
"ctor",
|
||||
"lazy_static",
|
||||
"nix-bindings-bindgen-raw",
|
||||
"nix-bindings-store",
|
||||
"nix-bindings-util",
|
||||
"nix-bindings-util-sys",
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
|
|
@ -237,9 +229,9 @@ dependencies = [
|
|||
"anyhow",
|
||||
"cstr",
|
||||
"ctor",
|
||||
"nix-bindings-bindgen-raw",
|
||||
"nix-bindings-store",
|
||||
"nix-bindings-util",
|
||||
"nix-bindings-util-sys",
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
|
|
@ -251,11 +243,11 @@ dependencies = [
|
|||
"cstr",
|
||||
"ctor",
|
||||
"lazy_static",
|
||||
"nix-bindings-bindgen-raw",
|
||||
"nix-bindings-expr",
|
||||
"nix-bindings-fetchers",
|
||||
"nix-bindings-store",
|
||||
"nix-bindings-util",
|
||||
"nix-bindings-util-sys",
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
|
|
@ -266,8 +258,8 @@ dependencies = [
|
|||
"anyhow",
|
||||
"ctor",
|
||||
"lazy_static",
|
||||
"nix-bindings-bindgen-raw",
|
||||
"nix-bindings-util",
|
||||
"nix-bindings-util-sys",
|
||||
"pkg-config",
|
||||
"tempfile",
|
||||
]
|
||||
|
|
@ -278,7 +270,15 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"anyhow",
|
||||
"ctor",
|
||||
"nix-bindings-bindgen-raw",
|
||||
"nix-bindings-util-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix-bindings-util-sys"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -315,18 +315,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.101"
|
||||
version = "1.0.105"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de"
|
||||
checksum = "535d180e0ecab6268a3e718bb9fd44db66bbbc256257165fc699dadf70d16fe7"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.41"
|
||||
version = "1.0.43"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1"
|
||||
checksum = "dc74d9a594b72ae6656596548f56f667211f8a97b3d4c3d467150794690dc40a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
|
@ -339,9 +339,9 @@ checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
|
|||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.11.3"
|
||||
version = "1.12.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b5288124840bee7b386bc413c487869b360b2b4ec421ea56425128692f2a82c"
|
||||
checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
|
|
@ -351,9 +351,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.11"
|
||||
version = "0.4.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "833eb9ce86d40ef33cb1306d8accf7bc8ec2bfea4355cbdebb3df68b40925cad"
|
||||
checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
|
|
@ -362,9 +362,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.6"
|
||||
version = "0.8.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001"
|
||||
checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
|
|
@ -387,15 +387,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "1.1.2"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e"
|
||||
checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys 0.11.0",
|
||||
"windows-sys 0.61.1",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -406,9 +406,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.106"
|
||||
version = "2.0.114"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6"
|
||||
checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
@ -417,31 +417,22 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.23.0"
|
||||
version = "3.24.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16"
|
||||
checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c"
|
||||
dependencies = [
|
||||
"fastrand",
|
||||
"getrandom",
|
||||
"once_cell",
|
||||
"rustix 1.1.2",
|
||||
"windows-sys 0.61.1",
|
||||
"rustix 1.1.3",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.19"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.14.7+wasi-0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "883478de20367e224c0090af9cf5f9fa85bed63a95c1abf3afc5c083ebc06e8c"
|
||||
dependencies = [
|
||||
"wasip2",
|
||||
]
|
||||
checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
|
||||
|
||||
[[package]]
|
||||
name = "wasip2"
|
||||
|
|
@ -466,9 +457,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65"
|
||||
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
|
|
@ -481,9 +472,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.61.1"
|
||||
version = "0.61.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f109e41dd4a3c848907eb83d5a42ea98b3769495597450cf6d153507b166f0f"
|
||||
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[workspace]
|
||||
members = [
|
||||
"nix-bindings-bindgen-raw",
|
||||
"nix-bindings-util-sys",
|
||||
"nix-bindings-expr",
|
||||
"nix-bindings-fetchers",
|
||||
"nix-bindings-flake",
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ This workspace provides multiple crates that wrap different layers of the Nix C
|
|||
- **`nix-bindings-flake`** - Flake operations
|
||||
- **`nix-bindings-fetchers`** - Fetcher functionality (requires Nix ≥ 2.29)
|
||||
|
||||
The `nix-bindings-bindgen-raw` crate contains the generated FFI bindings and is not intended for direct use.
|
||||
The `nix-bindings-util-sys` crate contains the generated FFI bindings and is not intended for direct use.
|
||||
|
||||
## Features
|
||||
|
||||
|
|
|
|||
4
nci.nix
4
nci.nix
|
|
@ -8,6 +8,10 @@
|
|||
# https://flake.parts/options/nix-cargo-integration
|
||||
nci.projects.nix-bindings = {
|
||||
path = ./.;
|
||||
profiles = {
|
||||
dev.drvConfig.env.RUSTFLAGS = "-D warnings";
|
||||
release.runTests = true;
|
||||
};
|
||||
drvConfig = {
|
||||
imports = [
|
||||
# Downstream projects import this into depsDrvConfig instead
|
||||
|
|
|
|||
|
|
@ -3,15 +3,17 @@ name = "nix-bindings-expr"
|
|||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
license = "LGPL-2.1"
|
||||
description = "Rust bindings to Nix expression evaluator"
|
||||
repository = "https://github.com/nixops4/nix-bindings-rust"
|
||||
|
||||
[lib]
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
nix-bindings-store = { path = "../nix-bindings-store" }
|
||||
nix-bindings-util = { path = "../nix-bindings-util" }
|
||||
nix-bindings-bindgen-raw = { path = "../nix-bindings-bindgen-raw" }
|
||||
nix-bindings-store = { path = "../nix-bindings-store", version = "0.1.0" }
|
||||
nix-bindings-util = { path = "../nix-bindings-util", version = "0.1.0" }
|
||||
nix-bindings-util-sys = { path = "../nix-bindings-util-sys", version = "0.1.0" }
|
||||
lazy_static = "1.4"
|
||||
ctor = "0.2"
|
||||
tempfile = "3.10"
|
||||
|
|
|
|||
|
|
@ -134,7 +134,6 @@ use anyhow::Context as _;
|
|||
use anyhow::{bail, Result};
|
||||
use cstr::cstr;
|
||||
use lazy_static::lazy_static;
|
||||
use nix_bindings_bindgen_raw as raw;
|
||||
use nix_bindings_store::path::StorePath;
|
||||
use nix_bindings_store::store::{Store, StoreWeak};
|
||||
use nix_bindings_util::context::Context;
|
||||
|
|
@ -142,6 +141,7 @@ use nix_bindings_util::string_return::{
|
|||
callback_get_result_string, callback_get_result_string_data,
|
||||
};
|
||||
use nix_bindings_util::{check_call, check_call_opt_key, result_string_init};
|
||||
use nix_bindings_util_sys as raw;
|
||||
use std::ffi::{c_char, CString};
|
||||
use std::iter::FromIterator;
|
||||
use std::os::raw::c_uint;
|
||||
|
|
@ -669,9 +669,9 @@ impl EvalState {
|
|||
///
|
||||
/// Returns [`Err`] if evaluation failed or the value is not an attribute set.
|
||||
///
|
||||
/// Returns [`Ok(None)`] if the attribute is not present.
|
||||
/// Returns `Ok(None)` if the attribute is not present.
|
||||
///
|
||||
/// Returns [`Ok(Some(value))`] if the attribute is present.
|
||||
/// Returns `Ok(Some(value))` if the attribute is present.
|
||||
#[doc(alias = "nix_get_attr_byname")]
|
||||
#[doc(alias = "get_attr_byname")]
|
||||
#[doc(alias = "get_attr_opt")]
|
||||
|
|
@ -721,11 +721,11 @@ impl EvalState {
|
|||
/// Extracts an element from a [list][`ValueType::List`] Nix value by index.
|
||||
///
|
||||
/// Forces [evaluation](https://nix.dev/manual/nix/latest/language/evaluation.html) and verifies the value is a list.
|
||||
/// Forces evaluation of the selected element, similar to [`require_attrs_select`].
|
||||
/// Forces evaluation of the selected element, similar to [`Self::require_attrs_select`].
|
||||
///
|
||||
/// Returns [`Ok(Some(value))`] if the element is found.
|
||||
/// Returns `Ok(Some(value))` if the element is found.
|
||||
///
|
||||
/// Returns [`Ok(None)`] if the index is out of bounds.
|
||||
/// Returns `Ok(None)` if the index is out of bounds.
|
||||
///
|
||||
/// Returns [`Err`] if evaluation failed, the element contains an error (e.g., `throw`), or the value is not a list.
|
||||
#[doc(alias = "get")]
|
||||
|
|
@ -917,7 +917,7 @@ impl EvalState {
|
|||
/// Applies a function to an argument and returns the result.
|
||||
///
|
||||
/// Forces [evaluation](https://nix.dev/manual/nix/latest/language/evaluation.html) of the function application.
|
||||
/// For a lazy version, see [`new_value_apply`].
|
||||
/// For a lazy version, see [`Self::new_value_apply`].
|
||||
#[doc(alias = "nix_value_call")]
|
||||
#[doc(alias = "value_call")]
|
||||
#[doc(alias = "apply")]
|
||||
|
|
@ -999,7 +999,7 @@ impl EvalState {
|
|||
/// Applies a function to an argument lazily, creating a [thunk](https://nix.dev/manual/nix/latest/language/evaluation.html#laziness).
|
||||
///
|
||||
/// Does not force [evaluation](https://nix.dev/manual/nix/latest/language/evaluation.html) of the function application.
|
||||
/// For an eager version, see [`call`].
|
||||
/// For an eager version, see [`Self::call`].
|
||||
#[doc(alias = "lazy_apply")]
|
||||
#[doc(alias = "thunk_apply")]
|
||||
#[doc(alias = "defer_call")]
|
||||
|
|
@ -1046,10 +1046,10 @@ impl EvalState {
|
|||
Ok(value)
|
||||
}
|
||||
|
||||
/// Creates a new [attribute set][`ValueType::Attrs`] Nix value from an iterator of name-value pairs.
|
||||
/// Creates a new [attribute set][`ValueType::AttrSet`] Nix value from an iterator of name-value pairs.
|
||||
///
|
||||
/// Accepts any iterator that yields `(String, Value)` pairs and has an exact size.
|
||||
/// Common usage includes [`Vec`], [`HashMap`], and array literals.
|
||||
/// Common usage includes [`Vec`], [`std::collections::HashMap`], and array literals.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use crate::eval_state::{EvalState, EvalStateWeak};
|
||||
use crate::value::Value;
|
||||
use anyhow::Result;
|
||||
use nix_bindings_bindgen_raw as raw;
|
||||
use nix_bindings_util::check_call;
|
||||
use nix_bindings_util_sys as raw;
|
||||
use std::ffi::{c_int, c_void, CStr, CString};
|
||||
use std::mem::ManuallyDrop;
|
||||
use std::ptr::{null, null_mut};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
pub mod __private;
|
||||
|
||||
use nix_bindings_bindgen_raw as raw;
|
||||
use nix_bindings_util::{check_call, context::Context};
|
||||
use nix_bindings_util_sys as raw;
|
||||
use std::ptr::{null_mut, NonNull};
|
||||
|
||||
// TODO: test: cloning a thunk does not duplicate the evaluation.
|
||||
|
|
@ -71,7 +71,7 @@ pub struct Value {
|
|||
impl Value {
|
||||
/// Take ownership of a new [`Value`].
|
||||
///
|
||||
/// This does not call [`nix_c_raw::gc_incref`], but does call [`nix_c_raw::nix_gc_decref`] when [dropped][`Drop`].
|
||||
/// This does not call [`nix_bindings_util_sys::gc_incref`], but does call [`nix_bindings_util_sys::gc_decref`] when [dropped][`Drop`].
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
|
|
@ -84,7 +84,7 @@ impl Value {
|
|||
|
||||
/// Borrow a reference to a [`Value`].
|
||||
///
|
||||
/// This calls [`nix_c_raw::value_incref`], and the returned Value will call [`nix_c_raw::value_decref`] when dropped.
|
||||
/// This calls [`nix_bindings_util_sys::value_incref`], and the returned Value will call [`nix_bindings_util_sys::value_decref`] when dropped.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
//! Functions that are relevant for other bindings modules, but normally not end users.
|
||||
use super::Value;
|
||||
use nix_bindings_bindgen_raw as raw;
|
||||
use nix_bindings_util_sys as raw;
|
||||
|
||||
/// Take ownership of a new [`Value`].
|
||||
///
|
||||
|
|
|
|||
|
|
@ -3,15 +3,17 @@ name = "nix-bindings-fetchers"
|
|||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
license = "LGPL-2.1"
|
||||
description = "Rust bindings to Nix fetchers"
|
||||
repository = "https://github.com/nixops4/nix-bindings-rust"
|
||||
|
||||
[lib]
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
nix-bindings-store = { path = "../nix-bindings-store" }
|
||||
nix-bindings-util = { path = "../nix-bindings-util" }
|
||||
nix-bindings-bindgen-raw = { path = "../nix-bindings-bindgen-raw" }
|
||||
nix-bindings-store = { path = "../nix-bindings-store", version = "0.1.0" }
|
||||
nix-bindings-util = { path = "../nix-bindings-util", version = "0.1.0" }
|
||||
nix-bindings-util-sys = { path = "../nix-bindings-util-sys", version = "0.1.0" }
|
||||
ctor = "0.2"
|
||||
tempfile = "3.10"
|
||||
cstr = "0.2"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::{Context as _, Result};
|
||||
use nix_bindings_bindgen_raw as raw;
|
||||
use nix_bindings_util::context::{self, Context};
|
||||
use nix_bindings_util_sys as raw;
|
||||
use std::ptr::NonNull;
|
||||
|
||||
pub struct FetchersSettings {
|
||||
|
|
|
|||
|
|
@ -3,17 +3,19 @@ name = "nix-bindings-flake"
|
|||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
license = "LGPL-2.1"
|
||||
description = "Rust bindings to Nix flakes"
|
||||
repository = "https://github.com/nixops4/nix-bindings-rust"
|
||||
|
||||
[lib]
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
nix-bindings-expr = { path = "../nix-bindings-expr" }
|
||||
nix-bindings-fetchers = { path = "../nix-bindings-fetchers" }
|
||||
nix-bindings-store = { path = "../nix-bindings-store" }
|
||||
nix-bindings-util = { path = "../nix-bindings-util" }
|
||||
nix-bindings-bindgen-raw = { path = "../nix-bindings-bindgen-raw" }
|
||||
nix-bindings-expr = { path = "../nix-bindings-expr", version = "0.1.0" }
|
||||
nix-bindings-fetchers = { path = "../nix-bindings-fetchers", version = "0.1.0" }
|
||||
nix-bindings-store = { path = "../nix-bindings-store", version = "0.1.0" }
|
||||
nix-bindings-util = { path = "../nix-bindings-util", version = "0.1.0" }
|
||||
nix-bindings-util-sys = { path = "../nix-bindings-util-sys", version = "0.1.0" }
|
||||
lazy_static = "1.4"
|
||||
ctor = "0.2"
|
||||
tempfile = "3.10"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
use std::{ffi::CString, os::raw::c_char, ptr::NonNull};
|
||||
|
||||
use anyhow::{Context as _, Result};
|
||||
use nix_bindings_bindgen_raw as raw;
|
||||
use nix_bindings_expr::eval_state::EvalState;
|
||||
use nix_bindings_fetchers::FetchersSettings;
|
||||
use nix_bindings_util::{
|
||||
|
|
@ -9,6 +8,7 @@ use nix_bindings_util::{
|
|||
result_string_init,
|
||||
string_return::{callback_get_result_string, callback_get_result_string_data},
|
||||
};
|
||||
use nix_bindings_util_sys as raw;
|
||||
|
||||
/// Store settings for the flakes feature.
|
||||
pub struct FlakeSettings {
|
||||
|
|
|
|||
|
|
@ -4,14 +4,16 @@ version = "0.1.0"
|
|||
edition = "2021"
|
||||
build = "build.rs"
|
||||
license = "LGPL-2.1"
|
||||
description = "Rust bindings to Nix store library"
|
||||
repository = "https://github.com/nixops4/nix-bindings-rust"
|
||||
|
||||
[lib]
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
nix-bindings-util = { path = "../nix-bindings-util" }
|
||||
nix-bindings-bindgen-raw = { path = "../nix-bindings-bindgen-raw" }
|
||||
nix-bindings-util = { path = "../nix-bindings-util", version = "0.1.0" }
|
||||
nix-bindings-util-sys = { path = "../nix-bindings-util-sys", version = "0.1.0" }
|
||||
lazy_static = "1.4"
|
||||
|
||||
[dev-dependencies]
|
||||
|
|
@ -21,7 +23,7 @@ tempfile = "3.10"
|
|||
[build-dependencies]
|
||||
pkg-config = "0.3"
|
||||
# Needed for version parsing in build.rs
|
||||
nix-bindings-util = { path = "../nix-bindings-util" }
|
||||
nix-bindings-util = { path = "../nix-bindings-util", version = "0.1.0" }
|
||||
|
||||
[lints.rust]
|
||||
warnings = "deny"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#![cfg(nix_at_least = "2.33.0pre")]
|
||||
|
||||
use nix_bindings_bindgen_raw as raw;
|
||||
use nix_bindings_util_sys as raw;
|
||||
use std::ptr::NonNull;
|
||||
|
||||
/// A Nix derivation
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
use std::ptr::NonNull;
|
||||
|
||||
use anyhow::Result;
|
||||
use nix_bindings_bindgen_raw as raw;
|
||||
use nix_bindings_util::{
|
||||
result_string_init,
|
||||
string_return::{callback_get_result_string, callback_get_result_string_data},
|
||||
};
|
||||
use nix_bindings_util_sys as raw;
|
||||
|
||||
pub struct StorePath {
|
||||
raw: NonNull<raw::StorePath>,
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
use anyhow::{bail, Error, Result};
|
||||
use lazy_static::lazy_static;
|
||||
use nix_bindings_bindgen_raw as raw;
|
||||
use nix_bindings_util::context::Context;
|
||||
use nix_bindings_util::string_return::{
|
||||
callback_get_result_string, callback_get_result_string_data,
|
||||
};
|
||||
use nix_bindings_util::{check_call, result_string_init};
|
||||
use nix_bindings_util_sys as raw;
|
||||
#[cfg(nix_at_least = "2.33.0pre")]
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::HashMap;
|
||||
|
|
@ -101,7 +101,7 @@ pub struct Store {
|
|||
impl Store {
|
||||
/// Open a store.
|
||||
///
|
||||
/// See [nix_c_raw::store_open] for more information.
|
||||
/// See [`nix_bindings_util_sys::store_open`] for more information.
|
||||
#[doc(alias = "nix_store_open")]
|
||||
pub fn open<'a, 'b>(
|
||||
url: Option<&str>,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
[package]
|
||||
name = "nix-bindings-bindgen-raw"
|
||||
name = "nix-bindings-util-sys"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
build = "build.rs"
|
||||
license = "LGPL-2.1"
|
||||
description = "Low-level FFI bindings to Nix utility library"
|
||||
repository = "https://github.com/nixops4/nix-bindings-rust"
|
||||
|
||||
[lib]
|
||||
path = "src/lib.rs"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
# nix-bindings-bindgen-raw
|
||||
# nix-bindings-util-sys
|
||||
|
||||
This crate contains generated bindings for the Nix C API.
|
||||
**You should not have to use this crate directly,** and so you should probably not add it to your dependencies.
|
||||
|
|
@ -7,10 +7,19 @@
|
|||
//! Normally you don't have to use this crate directly.
|
||||
//! Instead use `nix-store` and `nix-expr`.
|
||||
|
||||
// This file must only contain generated code, so that the module-level
|
||||
// #![allow(...)] attributes don't suppress warnings in hand-written code.
|
||||
// If you need to add hand-written code, use a submodule to isolate the
|
||||
// generated code. See:
|
||||
// https://github.com/nixops4/nixops4/pull/138/commits/330c3881be3d3cf3e59adebbe0ab1c0f15f6d2c9
|
||||
|
||||
// Standard bindgen suppressions for C naming conventions
|
||||
#![allow(non_upper_case_globals)]
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
// Clippy suppressions for generated C bindings
|
||||
// bindgen doesn't generate safety docs
|
||||
#![allow(clippy::missing_safety_doc)]
|
||||
// Rustdoc suppressions for generated C documentation
|
||||
// The C headers contain Doxygen-style documentation that doesn't translate
|
||||
// well to Rust's rustdoc format, causing various warnings:
|
||||
|
|
@ -3,13 +3,15 @@ name = "nix-bindings-util"
|
|||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
license = "LGPL-2.1"
|
||||
description = "Rust bindings to Nix utility library"
|
||||
repository = "https://github.com/nixops4/nix-bindings-rust"
|
||||
|
||||
[lib]
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
nix-bindings-bindgen-raw = { path = "../nix-bindings-bindgen-raw" }
|
||||
nix-bindings-util-sys = { path = "../nix-bindings-util-sys", version = "0.1.0" }
|
||||
ctor = "0.2"
|
||||
|
||||
[lints.rust]
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use anyhow::{bail, Result};
|
||||
use nix_bindings_bindgen_raw as raw;
|
||||
use nix_bindings_util_sys as raw;
|
||||
use std::ptr::null_mut;
|
||||
use std::ptr::NonNull;
|
||||
|
||||
/// A context for error handling, when interacting directly with the generated bindings for the C API in [nix_bindings_bindgen_raw].
|
||||
/// A context for error handling, when interacting directly with the generated bindings for the C API in [nix_bindings_util_sys].
|
||||
///
|
||||
/// The `nix-store` and `nix-expr` libraries that consume this type internally store a private context in their `EvalState` and `Store` structs to avoid allocating a new context for each operation. The state of a context is irrelevant when used correctly (e.g. with [check_call!]), so it's safe to reuse, and safe to allocate more contexts in methods such as [Clone::clone].
|
||||
pub struct Context {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use anyhow::Result;
|
||||
use nix_bindings_bindgen_raw as raw;
|
||||
use nix_bindings_util_sys as raw;
|
||||
use std::sync::Mutex;
|
||||
|
||||
use crate::{
|
||||
|
|
|
|||
|
|
@ -52,9 +52,9 @@ macro_rules! result_string_init {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use nix_bindings_bindgen_raw as raw;
|
||||
use nix_bindings_util_sys as raw;
|
||||
|
||||
/// Typecheck the function signature against the generated bindings in nix_bindings_bindgen_raw.
|
||||
/// Typecheck the function signature against the generated bindings in nix_bindings_util_sys.
|
||||
static _CALLBACK_GET_RESULT_STRING: raw::get_string_callback = Some(callback_get_result_string);
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue