fn nix_rules_to_json<P: AsRef<Path>>(path: P) -> Result<serde_json::Value> {
    let rules_filepath = path.as_ref().to_string_lossy();

    let nix_binary = env!("RAGENIX_NIX_BIN_PATH");
    let output = process::Command::new(nix_binary)
        .arg("eval")
        .arg("--experimental-features")
        .arg("nix-command flakes")
        .arg("--no-net")
        .arg("--impure")
        .arg("--json")
        .arg("--expr")
        .arg(format!("import {}", rules_filepath))
        .output()
        .wrap_err("failed to execute nix")?;

    if !output.status.success() {
        let stderr = String::from_utf8_lossy(&output.stderr);
        return Err(eyre!("Failed to read {} as JSON", rules_filepath))
            .with_section(|| stderr.trim().to_string().header("Stderr:"));
    }

    let val = serde_json::from_slice(&output.stdout)?;
    Ok(val)
}
/// Reads the rules file using Nix to output the attribute set as a JSON string.
/// Return value is parsed into a serde JSON value.
Reads the rules file using Nix to output the attribute set as a JSON string.
Return value is parsed into a serde JSON value.
Reads the rules file using Nix to output the attribute set as a JSON string . Return value is parsed into a serde JSON value .
fn nix_rules_to_json<P: AsRef<Path>>(path: P) -> Result<serde_json::Value> {
    let rules_filepath = path.as_ref().to_string_lossy();
    let nix_binary = env!("RAGENIX_NIX_BIN_PATH");
    let output = process::Command::new(nix_binary)
        .arg("eval")
        .arg("--experimental-features")
        .arg("nix-command flakes")
        .arg("--no-net")
        .arg("--impure")
        .arg("--json")
        .arg("--expr")
        .arg(format!("import {}", rules_filepath))
        .output()
        .wrap_err("failed to execute nix")?;
    if !output.status.success() {
        let stderr = String::from_utf8_lossy(&output.stderr);
        return Err(eyre!("Failed to read {} as JSON", rules_filepath))
            .with_section(|| stderr.trim().to_string().header("Stderr:"));
    }
    let val = serde_json::from_slice(&output.stdout)?;
    Ok(val)
}
fn nix_rules_to_json < P : AsRef < Path > > ( path : P ) -> Result < serde_json :: Value > { let rules_filepath = path . as_ref ( ) . to_string_lossy ( ) ; let nix_binary = env ! ( " " ) ; let output = process :: Command :: new ( nix_binary ) . arg ( " " ) . arg ( " " ) . arg ( " " ) . arg ( " " ) . arg ( " " ) . arg ( " " ) . arg ( " " ) . arg ( format ! ( " " rules_filepath ) ) . output ( ) . wrap_err ( " " ) ? ; if ! output . status . success ( ) { let stderr = String :: from_utf8_lossy ( & output . stderr ) ; return Err ( eyre ! ( " " rules_filepath ) ) . with_section ( | | stderr . trim ( ) . to_string ( ) . header ( " " ) ) ; } let val = serde_json :: from_slice ( & output . stdout ) ? ; Ok ( val ) }
Reads the rules file using Nix to output the attribute set as a JSON string.
Reads the rules file using Nix to output the attribute set as a JSON string .
path
P