1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! # Nix Command Interface
//!
//! Low-level interface for executing Nix commands from the CLI.
//!
//! This module provides functions for running Nix commands and checking
//! Nix availability, abstracting the subprocess management details.
use ;
use Command;
/// Execute a Nix command with the given arguments.
///
/// Returns a tuple of (stdout, stderr, success) where success indicates
/// whether the command exited with status code 0.
///
/// # Arguments
///
/// * `args` - Command-line arguments to pass to `nix`
///
/// # Example
///
/// ```rust,ignore
/// let (stdout, stderr, success) = run_nix_command(&["search", "nixpkgs", "ripgrep"])?;
/// if success {
/// println!("Found packages: {}", stdout);
/// }
/// ```
/// Check if Nix is available on the system.
///
/// Returns `true` if the `nix --version` command executes successfully,
/// indicating that Nix is installed and accessible in PATH.