diff --git a/.rustfmt.toml b/.rustfmt.toml index 70b5be0..d9417d1 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -1,10 +1,9 @@ # REF: https://github.com/rust-lang/rustfmt/blob/main/Configurations.md -unstable_features = true array_width = 60 attr_fn_like_width = 70 binop_separator = "Front" # Front|Back blank_lines_lower_bound = 1 -blank_lines_upper_bound = 1 +black_lines_upper_bound = 1 brace_style = "SameLineWhere" # AlwaysNextLine|PreferSameLine|SameLineWhere chain_width = 60 color = "Auto" # Auto|Always|Never @@ -16,8 +15,8 @@ disable_all_formatting = false # hell no edition = "2024" # 2015|2018|2021|2024 empty_item_single_line = true enum_discrim_align_threshold = 20 -error_on_line_overflow = false # DEBUG -error_on_unformatted = false # DEBUG +error_on_line_overflow = false +error_on_unformatted = true fn_call_width = 60 fn_params_layout = "Tall" # Compressed|Tall|Vertical fn_single_line = true @@ -27,13 +26,13 @@ format_code_in_doc_comments = true doc_comment_code_block_width = 100 format_generated_files = true generated_marker_line_search_limit = 5 -# format_macro_matches = true +format_macro_matches = true format_macro_bodies = true skip_macro_invocations = [] format_strings = true hard_tabs = false # fuck tabs hex_literal_case = "Lower" # Preserve|Upper|Lower -# float_literal_trailing_zero = "Never" # Preserve|Always|IfNoPostfix|Never +float_literal_trailing_zero = "Never" # Preserve|Always|IfNoPostfix|Never show_parse_errors = true # ignore = [] # same format as .gitignore imports_indent = "Block" # Block|Visual @@ -42,7 +41,7 @@ indent_style = "Block" # Block|Visual inline_attribute_width = 0 match_arm_blocks = true match_arm_leading_pipes = "Never" # Preserve|Always|Never -# match_arm_indent = true +match_arm_indent = true match_block_trailing_comma = true max_width = 100 merge_derives = true @@ -73,6 +72,7 @@ tab_spaces = 4 trailing_comma = "Always" # Vertical|Always|Never trailing_semicolon = true type_punctuation_density = "Wide" # Compressed|Wide +unstable_features = true use_field_init_shorthand = true use_small_heuristics = "Default" # Default|Off|Max use_try_shorthand = true diff --git a/nixide-sys/Cargo.toml b/nixide-sys/Cargo.toml index 640e70c..41a1b93 100644 --- a/nixide-sys/Cargo.toml +++ b/nixide-sys/Cargo.toml @@ -1,33 +1,35 @@ [package] name = "nixide-sys" -description = "Unsafe direct FFI bindings to the libnix C API" +description = "Unsafe direct FFI bindings to libnix C API" version = "0.1.0" readme = "../README.md" license = "GPL-3.0" -repository = "https://github.com/cry128/nixide" +repository = "https://codeberg.org/luminary/nixide" authors = [ "_cry64 " ] edition = "2024" build = "build.rs" +[package.metadata.docs.rs] +targets = [ "x86_64-unknown-linux-gnu" ] + [lib] path = "src/lib.rs" # NOTE: `[features]` have a 1-1 correspondence to the # NOTE: shared libraries produced by the Nix C API. [features] -default = [ "nix-util-c" ] -all = [ "nix-util-c", "nix-store-c", "nix-expr-c", "nix-fetchers-c", "nix-flake-c", "nix-main-c" ] -nix-util-c = [] -nix-store-c = [] -nix-expr-c = [] +default = ["nix-util-c"] +nix-util-c = [] +nix-store-c = [] +nix-expr-c = [] nix-fetchers-c = [] -nix-flake-c = [] -nix-main-c = [] +nix-flake-c = [] +nix-main-c = [] [build-dependencies] itertools = "0.14.0" -heck = "0.5.0" +heck = "0.5.0" # rust-bindgen bindgen = { default-features = false, features = [ "logging", "runtime" ], version = "0.72.1" } diff --git a/nixide/Cargo.toml b/nixide/Cargo.toml index a3c223b..d72f945 100644 --- a/nixide/Cargo.toml +++ b/nixide/Cargo.toml @@ -4,7 +4,7 @@ description = "Safe & oxidized bindings to the Nix API" version = "0.1.0" readme = "../README.md" license = "GPL-3.0" -repository = "https://github.com/cry128/nixide" +repository = "https://codeberg.org/luminary/nixide" authors = [ "_cry64 " ] edition = "2024" build = "build.rs" @@ -14,18 +14,17 @@ path = "src/lib.rs" [features] default = ["nix"] -all = ["nix", "store", "exprs", "flakes"] -nix = ["nixide-sys/nix-util-c", "nixide-sys/nix-main-c"] -store = ["nix", "nixide-sys/nix-store-c"] -exprs = ["store", "nixide-sys/nix-expr-c"] -flakes = ["exprs", "nixide-sys/nix-flake-c", "nixide-sys/nix-fetchers-c"] +nix = ["nixide-sys/nix-util-c", "nixide-sys/nix-main-c"] +store = ["nix", "nixide-sys/nix-store-c"] +exprs = ["store", "nixide-sys/nix-expr-c"] +flakes = ["exprs", "nixide-sys/nix-flake-c", "nixide-sys/nix-fetchers-c"] [dependencies] -libc = "0.2.183" -stdext = "0.3.3" -ctor = "0.6.3" +libc = "0.2.183" +stdext = "0.3.3" +ctor = "0.6.3" nixide-sys = { path = "../nixide-sys", version = "0.1.0" } -tempfile = "3.27.0" +tempfile = "3.27.0" [dev-dependencies] serial_test = "3.4.0" diff --git a/nixide/src/errors/context.rs b/nixide/src/errors/context.rs index 2046c38..44b2666 100644 --- a/nixide/src/errors/context.rs +++ b/nixide/src/errors/context.rs @@ -23,6 +23,7 @@ use std::ffi::CString; use std::ffi::c_uint; +use std::ffi::c_void; use std::ptr::NonNull; use super::{NixError, NixideResult}; diff --git a/nixide/src/expr/eval_state.rs b/nixide/src/expr/eval_state.rs index ec9b297..2f7c20a 100644 --- a/nixide/src/expr/eval_state.rs +++ b/nixide/src/expr/eval_state.rs @@ -49,12 +49,12 @@ impl EvalState { } #[inline] - pub(crate) fn inner_ref(&self) -> &Rc>> { + pub fn inner_ref(&self) -> &Rc>> { &self.inner } #[inline] - pub(crate) fn store_ref(&self) -> &Rc> { + pub fn store_ref(&self) -> &Rc> { &self.store } diff --git a/nixide/src/flake/fetchers_settings.rs b/nixide/src/flake/fetchers_settings.rs index 8873782..d56171f 100644 --- a/nixide/src/flake/fetchers_settings.rs +++ b/nixide/src/flake/fetchers_settings.rs @@ -1,4 +1,4 @@ -use std::ffi::CString; +use std::ffi::{CString, c_char}; use std::ptr::NonNull; use crate::NixideResult; diff --git a/nixide/src/flake/flake_lock_flags.rs b/nixide/src/flake/flake_lock_flags.rs index fa63b62..fb40ae0 100644 --- a/nixide/src/flake/flake_lock_flags.rs +++ b/nixide/src/flake/flake_lock_flags.rs @@ -1,4 +1,4 @@ -use std::ffi::CString; +use std::ffi::{CString, c_char}; use std::ptr::{self, NonNull}; use super::FlakeRef; diff --git a/nixide/src/flake/flakeref_builder.rs b/nixide/src/flake/flakeref_builder.rs index dc55c8a..bbb2278 100644 --- a/nixide/src/flake/flakeref_builder.rs +++ b/nixide/src/flake/flakeref_builder.rs @@ -1,4 +1,4 @@ -use std::ffi::CString; +use std::ffi::{CString, c_void}; use std::path::Path; use std::ptr::{self, NonNull, null_mut}; diff --git a/nixide/src/nix_settings.rs b/nixide/src/nix_settings.rs index c85e0b0..8b342fd 100644 --- a/nixide/src/nix_settings.rs +++ b/nixide/src/nix_settings.rs @@ -1,4 +1,4 @@ -use std::ffi::CString; +use std::ffi::{CString, c_void}; use crate::NixideResult; use crate::errors::{ErrorContext, ToNixideResult as _};