difftreelog
refactor cleanup bindings
in: trunk
12 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -729,22 +729,6 @@
]
[[package]]
-name = "ctor"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "67773048316103656a637612c4a62477603b777d91d9c62ff2290f9cde178fdb"
-dependencies = [
- "ctor-proc-macro",
- "dtor",
-]
-
-[[package]]
-name = "ctor-proc-macro"
-version = "0.0.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e2931af7e13dc045d8e9d26afccc6fa115d64e115c9c84b1166288b46f6782c2"
-
-[[package]]
name = "ctr"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -916,21 +900,6 @@
]
[[package]]
-name = "dtor"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e58a0764cddb55ab28955347b45be00ade43d4d6f3ba4bf3dc354e4ec9432934"
-dependencies = [
- "dtor-proc-macro",
-]
-
-[[package]]
-name = "dtor-proc-macro"
-version = "0.0.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f678cf4a922c215c63e0de95eb1ff08a958a81d47e485cf9da1e27bf6305cfa5"
-
-[[package]]
name = "ed25519"
version = "2.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1973,17 +1942,12 @@
version = "0.1.0"
dependencies = [
"anyhow",
- "better-command",
"bindgen",
- "ctor",
"cxx",
"cxx-build",
- "futures",
"itertools 0.14.0",
"nixlike",
"pkg-config",
- "r2d2",
- "regex",
"serde",
"serde_json",
"test-log",
@@ -1992,7 +1956,6 @@
"tokio-util",
"tracing",
"tracing-indicatif",
- "unindent",
]
[[package]]
@@ -2454,17 +2417,6 @@
version = "5.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
-
-[[package]]
-name = "r2d2"
-version = "0.8.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "51de85fb3fb6524929c8a2eb85e6b6d363de4e8c48f9e2c2eac4944abc181c93"
-dependencies = [
- "log",
- "parking_lot",
- "scheduled-thread-pool",
-]
[[package]]
name = "rand"
@@ -2829,15 +2781,6 @@
]
[[package]]
-name = "scheduled-thread-pool"
-version = "0.2.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3cbc66816425a074528352f5789333ecff06ca41b36b0b0efdfbb29edc391a19"
-dependencies = [
- "parking_lot",
-]
-
-[[package]]
name = "scopeguard"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3673,12 +3616,6 @@
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e"
-
-[[package]]
-name = "unindent"
-version = "0.2.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
[[package]]
name = "unit-prefix"
cmds/fleet/Cargo.tomldiffbeforeafterboth--- a/cmds/fleet/Cargo.toml
+++ b/cmds/fleet/Cargo.toml
@@ -55,4 +55,5 @@
"dep:indicatif",
"dep:human-repr",
"better-command/indicatif",
+ "nix-eval/indicatif",
]
cmds/fleet/src/cmds/build_systems.rsdiffbeforeafterboth--- a/cmds/fleet/src/cmds/build_systems.rs
+++ b/cmds/fleet/src/cmds/build_systems.rs
@@ -28,18 +28,12 @@
build_attr: String,
}
-async fn build_task(
- config: Config,
- hostname: String,
- build_attr: &str,
- // batch: Option<NixBuildBatch>,
-) -> Result<PathBuf> {
+async fn build_task(config: Config, hostname: String, build_attr: &str) -> Result<PathBuf> {
info!("building");
let host = config.host(&hostname).await?;
// let action = Action::from(self.subcommand.clone());
let nixos = host.nixos_config().await?;
let drv = nix_go!(nixos.system.build[{ build_attr }]);
- // let outputs = drv.build_maybe_batch(batch).await?;
let out_output = drv.build("out").await?;
// We already have system profiles for backups.
@@ -66,17 +60,11 @@
let hosts = opts.filter_skipped(config.list_hosts().await?).await?;
let set = LocalSet::new();
let build_attr = self.build_attr.clone();
- // let batch = (hosts.len() > 1).then(|| {
- // config
- // .nix_session
- // .new_build_batch("build-hosts".to_string())
- // });
for host in hosts {
let config = config.clone();
let span = info_span!("build", host = field::display(&host.name));
let hostname = host.name;
let build_attr = build_attr.clone();
- // let batch = batch.clone();
set.spawn_local(
(async move {
let built = match build_task(config, hostname.clone(), &build_attr).await {
@@ -107,11 +95,6 @@
pub async fn run(self, config: &Config, opts: &FleetOpts) -> Result<()> {
let hosts = opts.filter_skipped(config.list_hosts().await?).await?;
let set = LocalSet::new();
- // let batch = (hosts.len() > 1).then(|| {
- // config
- // .nix_session
- // .new_build_batch("deploy-hosts".to_string())
- // });
for host in hosts.into_iter() {
let config = config.clone();
let span = info_span!("deploy", host = field::display(&host.name));
cmds/fleet/src/cmds/secrets/mod.rsdiffbeforeafterboth--- a/cmds/fleet/src/cmds/secrets/mod.rs
+++ b/cmds/fleet/src/cmds/secrets/mod.rs
@@ -169,7 +169,6 @@
expected_owners: &[String],
expected_generation_data: serde_json::Value,
prefer_identities: &[String],
- // batch: Option<NixBuildBatch>,
) -> Result<FleetSharedSecret> {
let original_set = secret.owners.clone();
@@ -207,12 +206,10 @@
field,
expected_owners.to_vec(),
expected_generation_data,
- // batch,
)
.await?;
Ok(generated)
} else {
- // drop(batch);
let identity_holder = if !prefer_identities.is_empty() {
prefer_identities
.iter()
@@ -264,7 +261,6 @@
default_generator: Value,
expected_owners: &[String],
expected_generation_data: serde_json::Value,
- // batch: Option<NixBuildBatch>,
) -> Result<FleetSecret> {
let generator = nix_go!(secret.generator);
let on: Option<String> = nix_go_json!(default_generator.impureOn);
@@ -292,7 +288,6 @@
let generator = nix_go!(call_package(generator)(Obj {}));
- // let generator = generator.build_maybe_batch(batch).await?;
let generator = generator.build("out").await?;
let generator = host.remote_derivation(&generator).await?;
@@ -347,12 +342,11 @@
secret: Value,
expected_owners: &[String],
expected_generation_data: serde_json::Value,
- // batch: Option<NixBuildBatch>,
) -> Result<FleetSecret> {
let generator = nix_go!(secret.generator);
// Can't properly check on nix module system level
{
- let gen_ty = generator.type_of()?;
+ let gen_ty = generator.type_of();
if matches!(gen_ty, NixType::Null) {
bail!("secret has no generator defined, can't automatically generate it.");
}
@@ -394,7 +388,6 @@
default_generator,
expected_owners,
expected_generation_data,
- // batch,
)
.await
}
@@ -416,7 +409,6 @@
secret: Value,
expected_owners: Vec<String>,
expected_generation_data: serde_json::Value,
- // batch: Option<NixBuildBatch>,
) -> Result<FleetSharedSecret> {
// let owners: Vec<String> = nix_go_json!(secret.expectedOwners);
Ok(FleetSharedSecret {
@@ -426,7 +418,6 @@
secret,
&expected_owners,
expected_generation_data,
- // batch,
)
.await?,
owners: expected_owners,
@@ -747,7 +738,6 @@
let stored_shared_set = config.list_shared().into_iter().collect::<HashSet<_>>();
{
// Generate missing shared
- // let shared_batch = None;
let _span = info_span!("shared").entered();
let expected_shared_set = config
.list_configured_shared()
@@ -772,7 +762,6 @@
secret,
expected_owners,
expected_generation_data,
- // shared_batch.clone(),
)
.in_current_span()
.await?;
@@ -780,7 +769,6 @@
}
}
if !skip_hosts {
- // let hosts_batch = None;
for host in config.list_hosts().await? {
if opts.should_skip(&host).await? {
continue;
@@ -808,7 +796,6 @@
secret,
slice::from_ref(&host.name),
expected_generation_data,
- // hosts_batch.clone(),
)
.in_current_span()
.await
@@ -834,7 +821,6 @@
secret,
slice::from_ref(&host.name),
expected_generation_data,
- // hosts_batch.clone(),
)
.in_current_span()
.await
cmds/fleet/src/cmds/tf.rsdiffbeforeafterboth--- a/cmds/fleet/src/cmds/tf.rs
+++ b/cmds/fleet/src/cmds/tf.rs
@@ -1,8 +1,4 @@
-use std::{
- collections::{BTreeMap, HashMap},
- ffi::OsString,
- path::PathBuf,
-};
+use std::{collections::BTreeMap, ffi::OsString, path::PathBuf};
use anyhow::{Context, Result};
use clap::Parser;
crates/nix-eval/Cargo.tomldiffbeforeafterboth--- a/crates/nix-eval/Cargo.toml
+++ b/crates/nix-eval/Cargo.toml
@@ -7,26 +7,23 @@
[dependencies]
anyhow.workspace = true
-better-command.workspace = true
nixlike.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
thiserror.workspace = true
-tokio = { workspace = true, features = ["io-util", "process"] }
+tokio = { workspace = true }
tokio-util.workspace = true
tracing.workspace = true
cxx = "1.0.168"
-futures = "0.3.31"
itertools = "0.14.0"
-r2d2 = "0.8.10"
-regex = "1.11.1"
test-log = { version = "0.2.18", features = ["trace"] }
-unindent = "0.2.4"
-tracing-indicatif = "0.3.13"
-ctor = "0.5.0"
+tracing-indicatif = { version = "0.3.13", optional = true }
[build-dependencies]
bindgen = "0.72.0"
cxx-build = "1.0.168"
pkg-config = "0.3.30"
+
+[features]
+indicatif = ["dep:tracing-indicatif"]
crates/nix-eval/src/lib.rsdiffbeforeafterboth1//! This whole library should be replaced with either binding to nix libexpr,2//! or with tvix (once it is able to build NixOS).3//!4//! Current api is awful, little effort was put into this implementation.56use std::borrow::Cow;7use std::cell::RefCell;8use std::ffi::{CStr, CString, c_char, c_int, c_uint, c_void};9use std::fmt;10use std::ptr::null_mut;11use std::sync::LazyLock;12use std::{collections::HashMap, path::PathBuf};1314use anyhow::{Context, bail};15use serde::Serialize;16use serde::de::DeserializeOwned;1718pub use anyhow::Result;1920use self::logging::nix_logging_cxx;21use self::nix_cxx::set_fetcher_setting;22use self::nix_raw::{23 alloc_value, c_context, c_context_create, err_code, err_info_msg, eval_state_build,24 eval_state_builder_new, expr_eval_from_string, fetchers_settings, fetchers_settings_free,25 fetchers_settings_new, flake_lock, flake_lock_flags, flake_lock_flags_free,26 flake_lock_flags_new, flake_reference_parse_flags, flake_reference_parse_flags_free,27 flake_reference_parse_flags_new, flake_reference_parse_flags_set_base_directory,28 flake_settings, flake_settings_free, flake_settings_new, init_bool, init_int, init_string,29 locked_flake_free, locked_flake_get_output_attrs, set_err_msg, setting_set, state_free,30 value_decref, value_force, value_incref,31};3233mod value;34// Contains macros helpers35pub mod logging;36#[doc(hidden)]37pub mod macros;38pub mod util;3940#[allow(non_upper_case_globals, non_camel_case_types, non_snake_case)]41mod nix_raw {42 include!(concat!(env!("OUT_DIR"), "/bindings.rs"));43}44#[cxx::bridge]45pub mod nix_cxx {46 unsafe extern "C++" {47 type nix_fetchers_settings;48 include!("nix-eval/src/lib.hh");4950 unsafe fn set_fetcher_setting(51 settings: *mut nix_fetchers_settings,52 setting: *const c_char,53 value: *const c_char,54 );55 }56}5758#[derive(Debug, PartialEq, Eq)]59pub enum NixType {60 Thunk,61 Int,62 Float,63 Bool,64 String,65 Path,66 Null,67 Attrs,68 List,69 Function,70 External,71}72impl NixType {73 fn from_int(c: c_uint) -> Self {74 match c {75 0 => Self::Thunk,76 1 => Self::Int,77 2 => Self::Float,78 3 => Self::Bool,79 4 => Self::String,80 5 => Self::Path,81 6 => Self::Null,82 7 => Self::Attrs,83 8 => Self::List,84 9 => Self::Function,85 10 => Self::External,86 _ => unreachable!("unknown nix type: {c}"),87 }88 }89}9091#[derive(Debug)]92#[repr(i32)]93enum NixErrorKind {94 Unknown = 1,95 Overflow = 2,96 Key = 3,97 Generic = 4,98}99impl NixErrorKind {100 fn from_int(v: c_int) -> Option<Self> {101 Some(match v {102 0 => return None,103 -1 => Self::Unknown,104 -2 => Self::Overflow,105 -3 => Self::Key,106 -4 => Self::Generic,107 _ => {108 debug_assert!(false, "unexpected nix error kind: {v}");109 Self::Unknown110 }111 })112 }113}114115pub fn gc_register_my_thread() {116 assert_eq!(unsafe { nix_raw::GC_thread_is_registered() }, 0);117118 let mut sb = nix_raw::GC_stack_base {119 mem_base: null_mut(),120 };121 let r = unsafe { nix_raw::GC_get_stack_base(&mut sb) };122 if r as u32 != nix_raw::GC_SUCCESS {123 panic!("failed to get thread stack base");124 }125 unsafe { nix_raw::GC_register_my_thread(&sb) };126}127pub fn gc_unregister_my_thread() {128 assert_eq!(unsafe { nix_raw::GC_thread_is_registered() }, 1);129130 unsafe { nix_raw::GC_unregister_my_thread() };131}132133struct ThreadRegisterGuard {}134impl ThreadRegisterGuard {135 fn new() -> Self {136 gc_register_my_thread();137 Self {}138 }139}140impl Drop for ThreadRegisterGuard {141 fn drop(&mut self) {142 gc_unregister_my_thread();143 }144}145146struct NixContext(*mut c_context);147impl NixContext {148 fn set_err(&mut self, err: NixErrorKind, msg: &CStr) {149 unsafe { set_err_msg(self.0, err as c_int, msg.as_ptr()) };150 }151 fn new() -> Self {152 let ctx = unsafe { c_context_create() };153 Self(ctx)154 }155 fn error_kind(&self) -> Option<NixErrorKind> {156 let code = unsafe { err_code(self.0) };157 NixErrorKind::from_int(code)158 }159 fn error<'t>(&self) -> Option<Cow<'t, str>> {160 if let NixErrorKind::Generic = self.error_kind()? {161 let mut err_out = String::new();162 unsafe {163 err_info_msg(164 null_mut(),165 self.0,166 Some(copy_nix_str),167 (&raw mut err_out).cast(),168 )169 };170 return Some(Cow::Owned(err_out));171 };172173 // TODO: Can throw error (resulting in panic) if unable to retrieve error. Should be able to resolve by passing context as a first argument,174 // but it looks ugly175 let str = unsafe { nix_raw::err_msg(null_mut(), self.0, null_mut()) };176 Some(unsafe { CStr::from_ptr(str) }.to_string_lossy())177178 // TODO: There is also nix_err_info_msg, but I don't understand when it should be used179 // Some(match self.error_kind()? {180 // NixErrorKind::Generic => {181 // }182 // })183 }184 fn clean_err(&mut self) {185 unsafe {186 nix_raw::clear_err(self.0);187 }188 }189190 fn bail_if_error(&self) -> Result<()> {191 if let Some(err) = self.error() {192 bail!("{err}");193 };194 Ok(())195 }196197 fn run_in_context<T>(&mut self, f: impl FnOnce(*mut c_context) -> T) -> Result<T> {198 self.clean_err();199 let o = f(self.0);200 self.bail_if_error()?;201 self.clean_err();202 Ok(o)203 }204}205impl Drop for NixContext {206 fn drop(&mut self) {207 unsafe {208 nix_raw::c_context_free(self.0);209 }210 }211}212struct GlobalState {213 store: Store,214 state: EvalState,215}216impl GlobalState {217 fn new() -> Result<Self> {218 let mut ctx = NixContext::new();219 let store = ctx220 .run_in_context(|c| unsafe { nix_raw::store_open(c, c"daemon".as_ptr(), null_mut()) })221 .map(Store)?;222223 let builder = ctx.run_in_context(|c| unsafe { eval_state_builder_new(c, store.0) })?;224 ctx.run_in_context(|c| {225 unsafe {226 nix_raw::eval_state_builder_set_eval_setting(227 c,228 builder,229 c"lazy-trees".as_ptr(),230 c"true".as_ptr(),231 )232 }233 // eval_s234 })?;235 let state = ctx236 .run_in_context(|c| unsafe { eval_state_build(c, builder) })237 .map(EvalState)?;238239 Ok(Self { store, state })240 }241}242243struct ThreadState {244 ctx: NixContext,245}246impl ThreadState {247 fn new() -> Result<Self> {248 let ctx = NixContext::new();249250 Ok(Self { ctx })251 }252}253254static GLOBAL_STATE: LazyLock<GlobalState> =255 LazyLock::new(|| GlobalState::new().expect("global state init shouldn't fail"));256257thread_local! {258 static THREAD_STATE: RefCell<ThreadState> = RefCell::new(ThreadState::new().expect("thread state init shouldn't fail"));259}260fn with_default_context<T>(261 f: impl FnOnce(*mut c_context, *mut nix_raw::EvalState) -> T,262) -> Result<T> {263 let global = &GLOBAL_STATE.state;264 let (ctx, state) = THREAD_STATE.with_borrow_mut(|w| (w.ctx.0, global.0));265 let mut ctx = NixContext(ctx);266 let v = ctx.run_in_context(|c| f(c, state));267 // It is reused for thread268 std::mem::forget(ctx);269 v270}271272fn set_setting(s: &CStr, v: &CStr) -> Result<()> {273 with_default_context(|c, _| unsafe { setting_set(c, s.as_ptr(), v.as_ptr()) }).map(|_| ())274}275276pub struct FetchSettings(*mut fetchers_settings);277impl FetchSettings {278 pub fn new() -> Self {279 Self::try_new().expect("allocation should not fail")280 }281 fn try_new() -> Result<Self> {282 with_default_context(|c, _| unsafe { fetchers_settings_new(c) }).map(Self)283 }284 pub fn set(&mut self, setting: &CStr, value: &CStr) {285 unsafe {286 set_fetcher_setting(self.0.cast(), setting.as_ptr(), value.as_ptr());287 };288 }289}290unsafe impl Send for FetchSettings {}291unsafe impl Sync for FetchSettings {}292impl Drop for FetchSettings {293 fn drop(&mut self) {294 unsafe { fetchers_settings_free(self.0) };295 }296}297pub struct FlakeSettings(*mut flake_settings);298impl FlakeSettings {299 pub fn new() -> Result<Self> {300 with_default_context(|c, _| unsafe { flake_settings_new(c) }).map(Self)301 }302}303unsafe impl Send for FlakeSettings {}304unsafe impl Sync for FlakeSettings {}305impl Drop for FlakeSettings {306 fn drop(&mut self) {307 unsafe {308 flake_settings_free(self.0);309 }310 }311}312313struct FlakeReferenceParseFlags(*mut flake_reference_parse_flags);314impl FlakeReferenceParseFlags {315 fn new(settings: &mut FlakeSettings) -> Result<Self> {316 with_default_context(|c, _| unsafe { flake_reference_parse_flags_new(c, settings.0) })317 .map(Self)318 }319 fn set_base_dir(&mut self, dir: &str) -> Result<()> {320 with_default_context(|c, _| {321 unsafe {322 flake_reference_parse_flags_set_base_directory(323 c,324 self.0,325 dir.as_ptr().cast(),326 dir.len(),327 )328 };329 })330 }331}332impl Drop for FlakeReferenceParseFlags {333 fn drop(&mut self) {334 unsafe {335 flake_reference_parse_flags_free(self.0);336 }337 }338}339struct FlakeLockFlags(*mut flake_lock_flags);340impl FlakeLockFlags {341 fn new(settings: &mut FlakeSettings) -> Result<Self> {342 with_default_context(|c, _| unsafe { flake_lock_flags_new(c, settings.0) }).map(Self)343 }344}345impl Drop for FlakeLockFlags {346 fn drop(&mut self) {347 unsafe {348 flake_lock_flags_free(self.0);349 }350 }351}352353unsafe extern "C" fn copy_nix_str(start: *const c_char, n: c_uint, user_data: *mut c_void) {354 let s = unsafe { std::slice::from_raw_parts(start.cast::<u8>(), n as usize) };355 let s = std::str::from_utf8(s).expect("c string has invalid utf-8");356 unsafe { *user_data.cast::<String>() = s.to_owned() };357}358359struct Store(*mut nix_raw::Store);360unsafe impl Send for Store {}361unsafe impl Sync for Store {}362363struct EvalState(*mut nix_raw::EvalState);364impl EvalState {365 // TODO: store ownership366 fn new_raw(store: *mut nix_raw::Store) -> Result<Self> {367 let builder =368 with_default_context(|c, _| unsafe { nix_raw::eval_state_builder_new(c, store) })?;369370 with_default_context(|c, _| unsafe { eval_state_build(c, builder) }).map(Self)371372 // with_default_context(|c| state_create(c))373 }374}375unsafe impl Send for EvalState {}376unsafe impl Sync for EvalState {}377impl Drop for EvalState {378 fn drop(&mut self) {379 unsafe {380 state_free(self.0);381 }382 }383}384385pub struct FlakeReference(*mut nix_raw::flake_reference);386impl FlakeReference {387 pub fn new(s: &str, fetch: &FetchSettings) -> Result<(Self, String)> {388 let mut flake_settings = FlakeSettings::new()?;389 let mut parse_flags = FlakeReferenceParseFlags::new(&mut flake_settings)?;390391 // parse_flags.set_base_dir("/home/lach/build/fleet")?;392393 let mut out = null_mut();394 let mut fragment = String::new();395 // let fetch_settings = fetcher_settings;396 with_default_context(|c, _| unsafe {397 nix_raw::flake_reference_and_fragment_from_string(398 c,399 fetch.0,400 flake_settings.0,401 parse_flags.0,402 s.as_ptr().cast(),403 s.len(),404 &mut out,405 Some(copy_nix_str),406 (&raw mut fragment).cast(),407 )408 })?;409 assert!(!out.is_null());410411 Ok((Self(out), fragment))412 }413 pub fn lock(&mut self, fetch: &FetchSettings) -> Result<LockedFlake> {414 let mut settings = FlakeSettings::new()?;415 let lock_flags = FlakeLockFlags::new(&mut settings)?;416 with_default_context(|c, es| unsafe {417 flake_lock(c, fetch.0, settings.0, es, lock_flags.0, self.0)418 })419 .map(LockedFlake)420 }421}422unsafe impl Send for FlakeReference {}423unsafe impl Sync for FlakeReference {}424425pub struct LockedFlake(*mut nix_raw::locked_flake);426impl LockedFlake {427 pub fn get_attrs(&self, settings: &mut FlakeSettings) -> Result<Value> {428 with_default_context(|c, es| unsafe {429 locked_flake_get_output_attrs(c, settings.0, es, self.0)430 })431 .map(Value)432 }433}434unsafe impl Send for LockedFlake {}435unsafe impl Sync for LockedFlake {}436impl Drop for LockedFlake {437 fn drop(&mut self) {438 unsafe {439 locked_flake_free(self.0);440 };441 }442}443444type FieldName = [u8; 32];445fn init_field_name(v: &str) -> FieldName {446 let mut f = [0; 32];447 assert!(v.len() < 32, "max field name is 31 char");448 assert!(449 v.bytes().all(|v| v != 0),450 "nul bytes are unsupported in field name"451 );452 f[0..v.len()].copy_from_slice(v.as_bytes());453 f454}455456pub struct RealisedString(*mut nix_raw::realised_string);457impl fmt::Debug for RealisedString {458 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {459 self.as_str().fmt(f)460 }461}462463impl RealisedString {464 fn as_str(&self) -> &str {465 let len = unsafe { nix_raw::realised_string_get_buffer_size(self.0) };466 let data: *const u8 = unsafe { nix_raw::realised_string_get_buffer_start(self.0) }.cast();467 let data = unsafe { std::slice::from_raw_parts(data, len) };468 std::str::from_utf8(data).expect("non-utf8 strings not supported")469 }470 fn path_count(&self) -> usize {471 unsafe { nix_raw::realised_string_get_store_path_count(self.0) }472 }473 fn path(&self, i: usize) -> String {474 assert!(i < self.path_count());475 let path = unsafe { nix_raw::realised_string_get_store_path(self.0, i) };476 let mut err_out = String::new();477 unsafe { nix_raw::store_path_name(path, Some(copy_nix_str), (&raw mut err_out).cast()) };478 err_out479 }480}481482unsafe impl Send for RealisedString {}483impl Drop for RealisedString {484 fn drop(&mut self) {485 with_default_context(|c, _| unsafe { nix_raw::realised_string_free(self.0) })486 .expect("string free should not fail")487 }488}489490pub struct Value(*mut nix_raw::value);491492unsafe impl Send for Value {}493unsafe impl Sync for Value {}494495pub trait AsFieldName {496 fn as_field_name<T>(&self, v: impl FnOnce(FieldName) -> Result<T>) -> Result<T>;497 fn to_field_name(&self) -> Result<String>;498}499impl AsFieldName for Value {500 fn as_field_name<T>(&self, v: impl FnOnce(FieldName) -> Result<T>) -> Result<T> {501 let f = self.to_string()?;502 v(init_field_name(&f))503 }504 fn to_field_name(&self) -> Result<String> {505 self.to_string()506 }507}508impl<E> AsFieldName for E509where510 E: AsRef<str>,511{512 fn as_field_name<T>(&self, v: impl FnOnce(FieldName) -> Result<T>) -> Result<T> {513 let f = self.as_ref();514 v(init_field_name(f))515 }516 fn to_field_name(&self) -> Result<String> {517 Ok(self.as_ref().to_owned())518 }519}520521struct AttrsBuilder(*mut nix_raw::BindingsBuilder);522impl AttrsBuilder {523 fn new(capacity: usize) -> Self {524 with_default_context(|c, es| unsafe { nix_raw::make_bindings_builder(c, es, capacity) })525 .map(Self)526 .expect("alloc should not fail")527 }528 fn insert(&mut self, k: &impl AsFieldName, v: Value) {529 k.as_field_name(|name| {530 with_default_context(|c, _| unsafe {531 nix_raw::bindings_builder_insert(c, self.0, name.as_ptr().cast(), v.0)532 })533 })534 .expect("builder insert shouldn't fail");535 }536}537impl Drop for AttrsBuilder {538 fn drop(&mut self) {539 unsafe { nix_raw::bindings_builder_free(self.0) };540 }541}542543impl Value {544 pub fn new_attrs(v: HashMap<&str, Value>) -> Result<Self> {545 let out = Self::new_uninit()?;546 let mut b = AttrsBuilder::new(v.len());547 for (k, v) in v {548 b.insert(&k, v);549 }550 with_default_context(|c, _| unsafe { nix_raw::make_attrs(c, out.0, b.0) })?;551 Ok(out)552 }553 fn new_list<T: Into<Self>>(v: Vec<T>) -> Result<Self> {554 todo!()555 }556 fn new_uninit() -> Result<Self> {557 let out = with_default_context(|c, es| unsafe { alloc_value(c, es) })?;558 Ok(Self(out))559 }560 fn new_str(v: &str) -> Result<Self> {561 let s = CString::new(v).expect("string should not contain NULs");562 let uninit = Self::new_uninit()?;563 // String is copied, `s` is free to be dropped564 with_default_context(|c, _| unsafe { init_string(c, uninit.0, s.as_ptr()) })?;565 Ok(uninit)566 }567 fn new_int(i: i64) -> Result<Self> {568 let uninit = Self::new_uninit()?;569 with_default_context(|c, _| unsafe { init_int(c, uninit.0, i) })?;570 Ok(uninit)571 }572 fn new_bool(v: bool) -> Result<Self> {573 let uninit = Self::new_uninit()?;574 with_default_context(|c, _| unsafe { init_bool(c, uninit.0, v) })?;575 Ok(uninit)576 }577 fn force(&mut self, st: &mut EvalState) -> Result<()> {578 with_default_context(|c, _| unsafe { value_force(c, st.0, self.0) })?;579 Ok(())580 }581 pub fn type_of(&self) -> Result<NixType> {582 let ty = with_default_context(|c, _| unsafe { nix_raw::get_type(c, self.0) })?;583 Ok(NixType::from_int(ty))584 }585 pub fn to_string(&self) -> Result<String> {586 Ok(self.to_realised_string()?.as_str().to_owned())587 }588 pub fn to_realised_string(&self) -> Result<RealisedString> {589 with_default_context(|c, es| unsafe { nix_raw::string_realise(c, es, self.0, false) })590 .map(RealisedString)591592 // let store_paths = unsafe { nix_raw::realised_string_get_store_path_count(str) };593 // for i in 0..store_paths {594 // let store_path = unsafe { nix_raw::realised_string_get_store_path(str, i) };595 // nix_raw::store_path_name(store_path, callback, user_data);596 // }597 // dbg!(store_paths);598 // todo!();599 }600601 pub fn has_field(&self, field: &str) -> Result<bool> {602 let f = init_field_name(field);603 with_default_context(|c, es| unsafe {604 nix_raw::has_attr_byname(c, self.0, es, f.as_ptr().cast())605 })606 }607 // pub fn derivation_path(&self) {608 // nix_raw::real609 // }610 pub fn list_fields(&self) -> Result<Vec<String>> {611 if !matches!(self.type_of()?, NixType::Attrs) {612 bail!("invalid type: expected attrs");613 }614615 let len = with_default_context(|c, _| unsafe { nix_raw::get_attrs_size(c, self.0) })?;616 let mut out = Vec::with_capacity(len as usize);617618 for i in 0..len {619 let name = with_default_context(|c, es| unsafe {620 nix_raw::get_attr_name_byidx(c, self.0, es, i)621 })?;622 let c = unsafe { CStr::from_ptr(name) };623 out.push(c.to_str().expect("nix field names are utf-8").to_owned());624 }625 Ok(out)626 }627 pub fn get_elem(&self, v: usize) -> Result<Self> {628 if !matches!(self.type_of()?, NixType::List) {629 bail!("invalid type: expected list");630 }631 let len =632 with_default_context(|c, _| unsafe { nix_raw::get_list_size(c, self.0) })? as usize;633 if v >= len {634 bail!("oob list get: {v} >= {len}");635 }636637 with_default_context(|c, es| unsafe { nix_raw::get_list_byidx(c, self.0, es, v as u32) })638 .map(Self)639 }640 pub fn attrs_update(self, other: Value) -> Result<Self> {641 let a_fields = self.list_fields()?;642 let b_fields = other.list_fields()?;643 match (a_fields.len(), b_fields.len()) {644 (_, 0) => return Ok(self),645 (0, _) => return Ok(other),646 _ => {}647 }648 let mut out = HashMap::new();649 for f in a_fields.iter() {650 if b_fields.contains(f) {651 break;652 }653 out.insert(f.as_str(), self.get_field(f)?);654 }655 if out.is_empty() {656 // All fields from lhs are overriden by rhs657 return Ok(other);658 }659 for f in b_fields.iter() {660 out.insert(f.as_str(), other.get_field(f)?);661 }662 Self::new_attrs(out)663 }664 pub fn get_field(&self, name: impl AsFieldName) -> Result<Self> {665 if !matches!(self.type_of()?, NixType::Attrs) {666 bail!("invalid type: expected attrs");667 }668669 name.as_field_name(|name| {670 with_default_context(|c, es| unsafe {671 nix_raw::get_attr_byname(c, self.0, es, name.as_ptr().cast())672 })673 .map(Self)674 })675 .with_context(|| format!("getting field {:?}", name.to_field_name()))676 }677 pub fn call(&self, v: Value) -> Result<Self> {678 if !matches!(self.type_of()?, NixType::Function) {679 // TODO: Functors680 bail!("invalid type: expected function");681 }682683 let out = Value::new_uninit()?;684 with_default_context(|c, es| unsafe { nix_raw::value_call(c, es, self.0, v.0, out.0) })?;685686 Ok(out)687 }688 pub fn eval(v: &str) -> Result<Self> {689 let s = CString::new(v).expect("expression shouldn't have internal NULs");690 let out = Self::new_uninit()?;691 with_default_context(|c, es| unsafe {692 expr_eval_from_string(c, es, s.as_ptr(), c"/homeless-shelter".as_ptr(), out.0)693 })?;694 Ok(out)695 }696 pub async fn build(&self, output: &str) -> Result<PathBuf> {697 if !self.is_derivation() {698 bail!("expected derivation to build")699 }700 let output_name = self.get_field("outputName")?.to_string()?;701 let v = if output_name != output {702 let out = self.get_field(output)?;703 if !out.is_derivation() {704 bail!("unknown output: {output}");705 }706 out707 } else {708 self.clone()709 };710 // to_string here blocks until the path is built711 let drv_path = tokio::task::spawn_blocking(move || v.get_field("outPath")?.to_string())712 .await713 .expect("should not fail")?;714 Ok(PathBuf::from(drv_path))715 }716 pub fn as_json<T: DeserializeOwned>(&self) -> Result<T> {717 let to_json = Self::eval("builtins.toJSON")?;718 let s = to_json.call(self.clone())?.to_string()?;719 Ok(serde_json::from_str(&s)?)720 }721 pub fn serialized<T: Serialize>(v: &T) -> Result<Self> {722 Self::eval(&nixlike::serialize(v)?)723 }724725 // Convert to string/evaluate derivations/etc726 fn to_string_weak(&self) -> Result<String> {727 // TODO728 self.to_string()729 }730731 fn is_derivation(&self) -> bool {732 if !matches!(self.type_of(), Ok(NixType::Attrs)) {733 return false;734 }735 let Some(ty) = self.get_field("type").ok() else {736 return false;737 };738 matches!(ty.to_string().as_deref(), Ok("derivation"))739 }740}741742impl From<String> for Value {743 fn from(value: String) -> Self {744 Value::new_str(&value).expect("todo: TryFrom")745 }746}747impl From<bool> for Value {748 fn from(value: bool) -> Self {749 Value::new_bool(value).expect("todo: TryFrom")750 }751}752impl From<&str> for Value {753 fn from(value: &str) -> Self {754 Value::new_str(&value).expect("todo: TryFrom")755 }756}757impl<T> From<Vec<T>> for Value758where759 T: Into<Value>,760{761 fn from(value: Vec<T>) -> Self {762 Value::new_list(value).expect("todo: TryFrom")763 }764}765766impl Clone for Value {767 fn clone(&self) -> Self {768 with_default_context(|c, _| unsafe { value_incref(c, self.0) })769 .expect("value incref should not fail");770 Self(self.0)771 }772}773impl Drop for Value {774 fn drop(&mut self) {775 with_default_context(|c, _| unsafe { value_decref(c, self.0) })776 .expect("value drop should not fail");777 }778}779780pub fn init_libraries() {781 unsafe { nix_raw::GC_allow_register_threads() };782783 let mut ctx = NixContext::new();784 ctx.run_in_context(|c| unsafe { nix_raw::libutil_init(c) })785 .expect("util init should not fail");786 ctx.run_in_context(|c| unsafe { nix_raw::libstore_init(c) })787 .expect("store init should not fail");788 ctx.run_in_context(|c| unsafe { nix_raw::libexpr_init(c) })789 .expect("expr init should not fail");790791 nix_logging_cxx::apply_tracing_logger();792}793794#[test_log::test]795fn test_native() -> Result<()> {796 let mut fetch_settings = FetchSettings::new();797 fetch_settings.set(c"warn-dirty", c"false");798 //799800 let (mut r, _) = FlakeReference::new("/home/lach/build/fleet", &fetch_settings)?;801 let locked = r.lock(&fetch_settings)?;802 let attrs = locked.get_attrs(&mut FlakeSettings::new()?)?;803804 let builtins = Value::eval("builtins")?;805 dbg!(builtins.type_of()?);806807 dbg!(attrs.type_of()?);808 dbg!(attrs.list_fields()?);809 dbg!(810 attrs811 .get_field("packages")?812 .get_field("x86_64-linux")?813 .get_field("fleet")?814 .get_field("outPath")?815 .to_string()816 );817818 Ok(())819}820821// struct NixBuildTask(Value, oneshot::Sender<Result<HashMap<String, PathBuf>>>);822//823// #[derive(Clone)]824// pub struct NixBuildBatch {825// tx: mpsc::UnboundedSender<NixBuildTask>,826// }827//828// #[instrument(skip(values))]829// async fn build_multiple(name: String, values: Vec<Value>) -> Result<()> {830// let builtins = Value::eval("builtins")?;831// let drv = nix_go!(builtins.derivation(Obj {832// // FIXME: pass system from localSystem or fleet args833// // system,834// name,835// builder: "/bin/sh",836// // we want nothing from this derivation, it is only used to perform multiple builds at once.837// args: vec!["-c", "echo > $out"],838// preferLocalBuild: true,839// allowSubstitutes: false,840// buildInputs: values,841// }));842// drv.build()?;843// Ok(())844// }845//846// impl NixBuildBatch {847// fn new(name: String) -> Self {848// let (tx, mut rx) = mpsc::unbounded_channel::<NixBuildTask>();849//850// tokio::task::spawn(async move {851// let mut deps = vec![];852// let mut build_data = vec![];853// while let Some(task) = rx.recv().await {854// build_data.push(task.0.clone());855// deps.push(task);856// }857// if deps.is_empty() {858// return;859// }860// match build_multiple(name, build_data).await {861// Ok(_) => {862// for NixBuildTask(v, o) in deps {863// let _ = o.send(v.build());864// }865// }866// Err(e) => {867// for NixBuildTask(v, o) in deps {868// let s = v.to_string_weak();869// let s = match s {870// Ok(s) => s,871// Err(e) => {872// let _ = o.send(Err(e));873// continue;874// }875// };876// if PathBuf::from(s).exists() {877// let _ = o.send(v.build());878// } else {879// let _ = o.send(Err(e.clone()));880// }881// }882// }883// };884// });885// Self { tx }886// }887// pub async fn submit(self, task: Value) -> Result<HashMap<String, PathBuf>> {888// let Self { tx: task_tx } = self;889// let (tx, rx) = oneshot::channel();890// let _ = task_tx.send(NixBuildTask(task, tx));891// drop(task_tx);892// rx.await.expect("shoudn't be cancelled here")893// }894// }crates/nix-eval/src/logging.rsdiffbeforeafterboth--- a/crates/nix-eval/src/logging.rs
+++ b/crates/nix-eval/src/logging.rs
@@ -3,9 +3,10 @@
use std::sync::{LazyLock, Mutex};
use tracing::{
- Level, Metadata, Span, debug, debug_span, error, error_span, event, info, info_span, trace,
- trace_span, warn, warn_span,
+ Level, Span, debug, debug_span, error, error_span, info, info_span, trace, trace_span, warn,
+ warn_span,
};
+#[cfg(feature = "indicatif")]
use tracing_indicatif::span_ext::IndicatifSpanExt as _;
#[derive(Debug)]
@@ -31,8 +32,7 @@
}
fn parse_path(path: &str) -> &str {
- let path = strip_prefix_suffix(path, "\x1b[35;1m", "\x1b[0m").unwrap_or(path);
- path
+ strip_prefix_suffix(path, "\x1b[35;1m", "\x1b[0m").unwrap_or(path)
}
fn parse_drv(drv: &str) -> &str {
@@ -245,9 +245,9 @@
Debug,
Vomit,
}
-impl Into<tracing::Level> for Verbosity {
- fn into(self) -> tracing::Level {
- match self {
+impl From<Verbosity> for tracing::Level {
+ fn from(val: Verbosity) -> Self {
+ match val {
Verbosity::Error => Level::ERROR,
Verbosity::Warn => Level::WARN,
Verbosity::Notice => Level::WARN,
@@ -277,126 +277,9 @@
warn!("unknown log level: {u}");
Verbosity::Vomit
})
- }
-}
-
-#[derive(Hash, PartialEq, Eq, Clone, Copy)]
-enum MetadataKind {
- Span,
- Event,
-}
-// impl MetadataKind {
-// fn kind(&self) -> Kind {
-// match self {
-// MetadataKind::Span => Kind::SPAN,
-// MetadataKind::Event => Kind::EVENT,
-// }
-// }
-// }
-
-#[derive(Hash, PartialEq, Eq)]
-struct ForeignMetadataInfo {
- target: &'static str,
- level: Level,
- kind: MetadataKind,
- name: &'static str,
- module: Option<&'static str>,
- file: Option<&'static str>,
- line: Option<u32>,
- names: &'static [&'static str],
-}
-
-struct FakeCallsite;
-impl tracing::callsite::Callsite for FakeCallsite {
- fn set_interest(&self, interest: tracing::subscriber::Interest) {
- unreachable!()
- }
-
- fn metadata(&self) -> &Metadata<'_> {
- unreachable!()
- }
-}
-const FAKE_CALLSITE: FakeCallsite = FakeCallsite;
-
-#[cfg(false)]
-#[derive(Default)]
-struct ForeignSpanData {
- interned: HashSet<&'static str>,
- metadatas: HashMap<ForeignMetadataInfo, &'static Metadata<'static>>,
-}
-#[cfg(false)]
-impl ForeignSpanData {
- fn intern(&mut self, s: &str) -> &'static str {
- if let Some(v) = self.interned.get(s) {
- return *v;
- }
- let leaked: Box<str> = s.into();
- let leaked = Box::leak(leaked);
- self.interned.insert(leaked);
- return leaked;
- }
- fn alloc_metadata<'t>(
- &'t mut self,
- target: &'static str,
- level: Level,
- kind: MetadataKind,
- name: &'static str,
- module: Option<&'static str>,
- file: Option<&'static str>,
- line: Option<u32>,
- names: &'static [&'static str],
- ) -> &'static Metadata<'static> {
- let info = ForeignMetadataInfo {
- target,
- level,
- kind,
- name,
- module,
- file,
- line,
- names,
- };
- if let Some(v) = self.metadatas.get(&info) {
- return *v;
- }
- let fake = FakeCallsite;
- let metadata = Box::leak::<'static>(Box::new(Metadata::new(
- name,
- target,
- level,
- file,
- line,
- module,
- FieldSet::new(names, tracing::callsite::Identifier(&FAKE_CALLSITE)),
- kind.kind(),
- )));
-
- let meta_raw = &raw const *metadata;
- let fields_raw = &raw const *metadata.fields();
-
- // SAFETY: FieldSet struct should be inside of metadata struct... Which we assume here, but do not test
- // FIXME: Safety comment above might be invalidated at any time, this should actually be covered by unit test (or, better: runtime assertion... Somehow.)
- let fields_offset = unsafe { fields_raw.cast::<u8>().offset_from(meta_raw.cast()) };
- let field_set = unsafe {
- ((&raw mut *metadata).cast::<()>())
- .byte_offset(fields_offset)
- .cast::<FieldSet>()
- };
- // FIXME: metadata borrow here invalidates our &mut borrow of 'static Metadata, and 'static FieldSet so this construction should be replaced with raw pointers or idk.
- // Something should be better done inside of tracing crate itself, someting like interior mutability.
- let callsite = Box::leak(Box::new(tracing::callsite::DefaultCallsite::new(metadata)));
- unsafe { *field_set = FieldSet::new(names, tracing::callsite::Identifier(callsite)) };
-
- tracing::callsite::register(&*callsite);
-
- self.metadatas.insert(info, metadata);
- return metadata;
}
}
-#[cfg(false)]
-static FOREIGN_SPAN_DATA: LazyLock<Mutex<ForeignSpanData>> =
- LazyLock::new(|| Mutex::new(ForeignSpanData::default()));
static NIX_SPAN_MAPPING: LazyLock<Mutex<HashMap<u64, Span>>> =
LazyLock::new(|| Mutex::new(HashMap::new()));
@@ -491,7 +374,10 @@
}
};
if !s.trim().is_empty() {
- span.pb_set_message(s);
+ #[cfg(feature = "indicatif")]
+ {
+ span.pb_set_message(s);
+ }
let _e = span.enter();
let level: Level = self.verbosity.into();
if level == Level::ERROR {
@@ -506,12 +392,15 @@
trace!(target: "nix", "{}", s)
}
} else {
- span.pb_start();
+ #[cfg(feature = "indicatif")]
+ {
+ span.pb_start();
+ }
}
mapping.insert(self.activity_id, span);
}
fn emit_result(&mut self, ty: u32) {
- let mut mapping = NIX_SPAN_MAPPING.lock().expect("not poisoned");
+ let mapping = NIX_SPAN_MAPPING.lock().expect("not poisoned");
let Some(parent) = mapping.get(&self.activity_id) else {
panic!("unexpected result for dead parent");
@@ -536,9 +425,12 @@
// parent.pb_set_message(phase);
debug!(target: "nix::phase", phase)
}
- (ResultType::Progress, [Int(done), Int(expected), Int(_), Int(_)]) => {
- parent.pb_set_length(*expected as u64);
- parent.pb_set_position(*done as u64);
+ (ResultType::Progress, [Int(_done), Int(_expected), Int(_), Int(_)]) => {
+ #[cfg(feature = "indicatif")]
+ {
+ parent.pb_set_length(*_expected as u64);
+ parent.pb_set_position(*_done as u64);
+ }
}
_ => warn!("unknown progress report: {:?}({:?})", &res, &self.fields),
}
@@ -575,10 +467,6 @@
trace!(target: "nix", "{v}")
}
}
-
-// fn start_activity(act: u64, lvl: u32, act_ty: u32, s: &str, parent: u32) {
-// tracing::Span::new(meta, values)
-// }
#[cxx::bridge]
pub mod nix_logging_cxx {
crates/nix-eval/src/macros.rsdiffbeforeafterboth--- a/crates/nix-eval/src/macros.rs
+++ b/crates/nix-eval/src/macros.rs
@@ -20,7 +20,7 @@
use $crate::{nix_expr_inner};
let mut out = std::collections::hash_map::HashMap::new();
nix_expr_inner!(@obj(out) $($tt)*);
- Value::new_attrs(out)?
+ Value::new_attrs(out)
}};
(@field($o:ident) . $var:ident $($tt:tt)*) => {{
$o.index_attr(stringify!($var));
crates/nix-eval/src/value.rsdiffbeforeafterboth--- a/crates/nix-eval/src/value.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-use std::{collections::HashMap, fmt, path::PathBuf, sync::Arc};
-
-use better_command::NixHandler;
-use serde::{Serialize, de::DeserializeOwned};
-
-use crate::{Result, Value, nix_go};
flake.lockdiffbeforeafterboth--- a/flake.lock
+++ b/flake.lock
@@ -104,14 +104,18 @@
"nixpkgs-regression": "nixpkgs-regression"
},
"locked": {
- "lastModified": 1756860322,
- "narHash": "sha256-mT01CpWVdqSm79L270dSkjdYbdc37r+Hq9vk4GTp7Ao=",
- "path": "/home/lach/build/nix-src",
- "type": "path"
+ "lastModified": 1757000273,
+ "narHash": "sha256-9AKhwsSlegWnNFy8++OMNctrxJUUIE7nG4s4ZHmFPic=",
+ "owner": "deltarocks",
+ "repo": "nix",
+ "rev": "eba1f549ec21208cf98343f1351a95e2e6eb3fbb",
+ "type": "github"
},
"original": {
- "path": "/home/lach/build/nix-src",
- "type": "path"
+ "owner": "deltarocks",
+ "ref": "fleet",
+ "repo": "nix",
+ "type": "github"
}
},
"nixpkgs": {
flake.nixdiffbeforeafterboth--- a/flake.nix
+++ b/flake.nix
@@ -19,7 +19,7 @@
};
# DeterminateSystem's nix fork is controversial, but I don't mind it,
# and it has lazy-trees support which is useful for fleet.
- nix.url = "/home/lach/build/nix-src";
+ nix.url = "github:deltarocks/nix/fleet";
};
outputs =
inputs:
@@ -44,10 +44,13 @@
fleetModules.tf = ./modules/extras/tf.nix;
- testObj = {
- v = "Hello";
+ # Used to test nix-eval bindings
+ testData = {
+ testObj = {
+ v = "Hello";
+ };
+ testString = "hello";
};
- testString = "hello";
# To be used with https://github.com/NixOS/nix/pull/8892
schemas =