Compare commits

...

5 commits

Author SHA1 Message Date
4ca2857500
dylib not needed 2026-04-14 13:25:35 +10:00
4ac2855bc8
ensure libs always link correctly 2026-04-14 13:25:22 +10:00
89bcc2dcff
clean nixide_api 2026-04-14 13:25:10 +10:00
db418c2411
update Cargo.lock 2026-04-14 13:23:04 +10:00
acff323b19
fix nixops4 bindings should use nix_value_call_multi 2026-04-14 13:22:49 +10:00
7 changed files with 25 additions and 30 deletions

34
Cargo.lock generated
View file

@ -44,9 +44,9 @@ checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.2.56" version = "1.2.60"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aebf35691d1bfb0ac386a69bac2fde4dd276fb618cf8bf4f5318fe285e821bb2" checksum = "43c5703da9466b66a946814e1adf53ea2c90f10063b86290cc9eb67ce3478a20"
dependencies = [ dependencies = [
"find-msvc-tools", "find-msvc-tools",
"shlex", "shlex",
@ -142,9 +142,9 @@ dependencies = [
[[package]] [[package]]
name = "fastrand" name = "fastrand"
version = "2.3.0" version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6"
[[package]] [[package]]
name = "find-msvc-tools" name = "find-msvc-tools"
@ -223,9 +223,9 @@ dependencies = [
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
version = "0.16.1" version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51"
[[package]] [[package]]
name = "heck" name = "heck"
@ -241,12 +241,12 @@ checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "2.13.0" version = "2.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
dependencies = [ dependencies = [
"equivalent", "equivalent",
"hashbrown 0.16.1", "hashbrown 0.17.0",
"serde", "serde",
"serde_core", "serde_core",
] ]
@ -283,9 +283,9 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.183" version = "0.2.185"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d" checksum = "52ff2c0fe9bc6cb6b14a0592c2ff4fa9ceb83eea9db979b0487cd054946a2b8f"
[[package]] [[package]]
name = "libloading" name = "libloading"
@ -402,9 +402,9 @@ checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
[[package]] [[package]]
name = "pkg-config" name = "pkg-config"
version = "0.3.32" version = "0.3.33"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e"
[[package]] [[package]]
name = "prettyplease" name = "prettyplease"
@ -480,9 +480,9 @@ checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a"
[[package]] [[package]]
name = "rustc-hash" name = "rustc-hash"
version = "2.1.1" version = "2.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe"
[[package]] [[package]]
name = "rustix" name = "rustix"
@ -520,9 +520,9 @@ checksum = "490dcfcbfef26be6800d11870ff2df8774fa6e86d047e3e8c8a76b25655e41ca"
[[package]] [[package]]
name = "semver" name = "semver"
version = "1.0.27" version = "1.0.28"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
[[package]] [[package]]
name = "serde" name = "serde"

View file

@ -15,7 +15,6 @@ targets = [ "x86_64-unknown-linux-gnu" ]
[lib] [lib]
path = "src/lib.rs" path = "src/lib.rs"
# crate-type = ["dylib"] # build libnixide_sys.so
# NOTE: `[features]` have a 1-1 correspondence to the # NOTE: `[features]` have a 1-1 correspondence to the
# NOTE: shared libraries produced by the Nix C API. # NOTE: shared libraries produced by the Nix C API.

View file

@ -118,6 +118,9 @@ fn main() {
.map(|lib| lib.link_files) .map(|lib| lib.link_files)
.flatten() .flatten()
.unique() .unique()
.inspect(|path|
println!("cargo::rustc-link-lib={}", path.display())
)
.collect(); .collect();
// build the libnixide-c extension // build the libnixide-c extension

View file

@ -1,17 +1,8 @@
// #include <string>
// #include <nix_api_flake.h>
#include <nix_api_flake_internal.hh> #include <nix_api_flake_internal.hh>
// #include <nix_api_util.h>
#include <nix_api_util_internal.h> #include <nix_api_util_internal.h>
// #include <nix_api_expr_internal.h>
// #include <nix_api_fetchers_internal.hh>
// #include <nix_api_fetchers.h>
#include "nix/flake/flake.hh" #include "nix/flake/flake.hh"
// #include "nixide_api_flake.h"
extern "C" { extern "C" {
nix_err nix_flake_lock_flags_set_recreate_lock_file(nix_c_context * context, nix_flake_lock_flags * flags, bool value) nix_err nix_flake_lock_flags_set_recreate_lock_file(nix_c_context * context, nix_flake_lock_flags * flags, bool value)

View file

@ -9,6 +9,7 @@ extern "C" {
nix_err nix_register_plugin(nix_c_context * context, char * plugin) nix_err nix_register_plugin(nix_c_context * context, char * plugin)
{ {
// DEBUG: TODO
if (context) if (context)
context->last_err_code = NIX_OK; context->last_err_code = NIX_OK;
if (plugin == nullptr) { if (plugin == nullptr) {

View file

@ -307,7 +307,8 @@ fn primop_function_call() {
let result = nix_alloc_value(ctx, state); let result = nix_alloc_value(ctx, state);
assert!(!result.is_null()); assert!(!result.is_null());
let call_err = nix_value_call(ctx, state, primop_value, ptr::null_mut(), result); let call_err =
nix_value_call_multi(ctx, state, primop_value, 0, ptr::null_mut(), result);
if call_err == NixErr::Ok { if call_err == NixErr::Ok {
// Force the result // Force the result
let force_err = nix_value_force(ctx, state, result); let force_err = nix_value_force(ctx, state, result);

View file

@ -45,7 +45,7 @@ impl NixVersion {
/// ///
/// # Examples /// # Examples
/// ///
/// ``` /// ```rs
/// use nixide::NixVersion; /// use nixide::NixVersion;
/// ///
/// assert_eq!(NixVersion::parse("2.26"), Ok(NixVersion::new(2, 26, 0, false))); /// assert_eq!(NixVersion::parse("2.26"), Ok(NixVersion::new(2, 26, 0, false)));
@ -72,7 +72,7 @@ impl NixVersion {
s[..offset].parse::<u32>()?, // patch s[..offset].parse::<u32>()?, // patch
length > 3 && s.ends_with("pre"), // is_prerelease length > 3 && s.ends_with("pre"), // is_prerelease
) )
} },
None => (0, false), None => (0, false),
}; };