daemon w/ tests PoC

This commit is contained in:
Qyriad 2026-03-22 17:15:04 +01:00
parent 68fc04a6d2
commit 7f4a5a35ca
13 changed files with 498 additions and 81 deletions

View file

@ -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>,
},
}