27 lines
581 B
Rust
27 lines
581 B
Rust
#[allow(unused_imports)]
|
|
use crate::prelude::*;
|
|
|
|
#[derive(Debug, Clone, PartialEq, Hash)]
|
|
pub(crate) struct NixEvalExpr<E, A> {
|
|
pub(crate) expr: E,
|
|
pub(crate) attrpath: A,
|
|
}
|
|
|
|
impl<E, A> NixEvalExpr<E, A>
|
|
where
|
|
E: AsRef<OsStr>,
|
|
A: AsRef<OsStr>,
|
|
{
|
|
pub(crate) fn into_command(self) -> Command {
|
|
let mut cmd = Command::new("nix-instantiate");
|
|
cmd.arg("--eval")
|
|
.arg("--json")
|
|
.arg("--strict")
|
|
.arg("--expr")
|
|
.arg(self.expr)
|
|
.arg("-A")
|
|
.arg(self.attrpath);
|
|
|
|
cmd
|
|
}
|
|
}
|