pub struct NixBackend {
pub indent_width: usize,
}Expand description
The Nix code generation backend.
Converts OxiLean IR constructs into Nix expression language output.
Fields§
§indent_width: usizeIndent width (default 2)
Implementations§
Source§impl NixBackend
impl NixBackend
Sourcepub fn emit_expr(&self, expr: &NixExpr, indent: usize) -> String
pub fn emit_expr(&self, expr: &NixExpr, indent: usize) -> String
Emit a NixExpr at the given indentation level.
Sourcepub fn emit_module(&self, module: &NixModule) -> String
pub fn emit_module(&self, module: &NixModule) -> String
Emit a complete NixModule as a .nix file string.
Sourcepub fn emit_function(&self, func: &NixFunction, indent: usize) -> String
pub fn emit_function(&self, func: &NixFunction, indent: usize) -> String
Emit a NixFunction.
Sourcepub fn make_derivation(
&self,
name: &str,
version: &str,
src: NixExpr,
build_inputs: Vec<NixExpr>,
build_phase: Option<&str>,
install_phase: Option<&str>,
extra_attrs: Vec<NixAttr>,
) -> NixExpr
pub fn make_derivation( &self, name: &str, version: &str, src: NixExpr, build_inputs: Vec<NixExpr>, build_phase: Option<&str>, install_phase: Option<&str>, extra_attrs: Vec<NixAttr>, ) -> NixExpr
Build a mkDerivation call from common parameters.
Sourcepub fn make_nixos_module(
&self,
module_args: Vec<(String, Option<NixExpr>)>,
options: Vec<NixAttr>,
config: Vec<NixAttr>,
) -> NixModule
pub fn make_nixos_module( &self, module_args: Vec<(String, Option<NixExpr>)>, options: Vec<NixAttr>, config: Vec<NixAttr>, ) -> NixModule
Build a NixOS module skeleton with options and config sections.
Sourcepub fn make_overlay(&self, attrs: Vec<NixAttr>) -> NixExpr
pub fn make_overlay(&self, attrs: Vec<NixAttr>) -> NixExpr
Build an overlay expression: final: prev: { ... }
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NixBackend
impl RefUnwindSafe for NixBackend
impl Send for NixBackend
impl Sync for NixBackend
impl Unpin for NixBackend
impl UnsafeUnpin for NixBackend
impl UnwindSafe for NixBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more