daemon w/ tests PoC
This commit is contained in:
parent
68fc04a6d2
commit
7f4a5a35ca
13 changed files with 498 additions and 81 deletions
|
|
@ -47,6 +47,24 @@ impl ConvenientAttrPath {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum NixLiteral {
|
||||
String(String),
|
||||
Number(f64),
|
||||
// FIXME: add the rest =P
|
||||
}
|
||||
|
||||
impl NixLiteral {
|
||||
pub fn to_nix_source(&self) -> String {
|
||||
match self {
|
||||
NixLiteral::String(s) => format!("\"{s}\""),
|
||||
NixLiteral::Number(n) => n.to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[serde(tag = "action", content = "args", rename_all = "snake_case")]
|
||||
|
|
@ -54,6 +72,6 @@ impl ConvenientAttrPath {
|
|||
pub enum DaemonCmd {
|
||||
Append {
|
||||
name: ConvenientAttrPath,
|
||||
value: Box<str>,
|
||||
value: Box<NixLiteral>,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue