support nix_flake_settings extensions
This commit is contained in:
parent
e3c315050f
commit
38a8128d32
1 changed files with 54 additions and 0 deletions
|
|
@ -2,6 +2,7 @@ use std::ptr::NonNull;
|
|||
|
||||
use crate::NixideResult;
|
||||
use crate::errors::ErrorContext;
|
||||
use crate::stdext::AsCPtr as _;
|
||||
use crate::sys;
|
||||
use crate::util::wrap;
|
||||
use crate::util::wrappers::AsInnerPtr;
|
||||
|
|
@ -44,4 +45,57 @@ impl FlakeSettings {
|
|||
|
||||
Ok(Self { inner })
|
||||
}
|
||||
|
||||
/// # Nix C API Internals
|
||||
///
|
||||
/// This binding is **not provided by the Nix C API.**
|
||||
/// It is instead **exposed by the Nixide C API extensions.**
|
||||
///
|
||||
#[allow(unused)]
|
||||
pub fn use_registries(self, value: bool) -> Self {
|
||||
wrap::nix_fn!(|ctx: &ErrorContext| unsafe {
|
||||
sys::nix_flake_settings_set_use_registries(ctx.as_ptr(), self.as_ptr(), value)
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
/// # Nix C API Internals
|
||||
///
|
||||
/// This binding is **not provided by the Nix C API.**
|
||||
/// It is instead **exposed by the Nixide C API extensions.**
|
||||
///
|
||||
#[allow(unused)]
|
||||
pub fn accept_flake_config(self, value: bool) -> Self {
|
||||
wrap::nix_fn!(|ctx: &ErrorContext| unsafe {
|
||||
sys::nix_flake_settings_set_accept_flake_config(ctx.as_ptr(), self.as_ptr(), value)
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
/// # Errors
|
||||
/// Fails if the given `path` contains a NUL byte.
|
||||
///
|
||||
/// # Nix C API Internals
|
||||
///
|
||||
/// This binding is **not provided by the Nix C API.**
|
||||
/// It is instead **exposed by the Nixide C API extensions.**
|
||||
///
|
||||
#[allow(unused)]
|
||||
pub fn commit_lock_file_summary(self, summary: &str) -> NixideResult<Self> {
|
||||
let summary_ptr = summary.into_c_ptr()?;
|
||||
wrap::nix_fn!(|ctx: &ErrorContext| unsafe {
|
||||
sys::nix_flake_settings_set_commit_lock_file_summary(
|
||||
ctx.as_ptr(),
|
||||
self.as_ptr(),
|
||||
summary_ptr,
|
||||
)
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
Ok(self)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue