From 38a8128d32fca01df8618f7e74d851aac62efc38 Mon Sep 17 00:00:00 2001 From: _cry64 Date: Fri, 10 Apr 2026 12:55:56 +1000 Subject: [PATCH] support nix_flake_settings extensions --- nixide/src/flake/flake_settings.rs | 54 ++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/nixide/src/flake/flake_settings.rs b/nixide/src/flake/flake_settings.rs index e021f4f..3af309a 100644 --- a/nixide/src/flake/flake_settings.rs +++ b/nixide/src/flake/flake_settings.rs @@ -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 { + 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) + } }