flake update:

This commit is contained in:
Robin Appelman 2026-02-10 19:18:00 +01:00
commit 2ff729bfa5
6 changed files with 38 additions and 32 deletions

View file

@ -2,6 +2,7 @@
name = "lightflash" name = "lightflash"
version = "0.1.0" version = "0.1.0"
edition = "2024" edition = "2024"
rust-version = "1.91.1"
[dependencies] [dependencies]
serde = { version = "1.0.228", features = ["derive"] } serde = { version = "1.0.228", features = ["derive"] }

34
flake.lock generated
View file

@ -2,11 +2,11 @@
"nodes": { "nodes": {
"crane": { "crane": {
"locked": { "locked": {
"lastModified": 1748970125, "lastModified": 1763938834,
"narHash": "sha256-UDyigbDGv8fvs9aS95yzFfOKkEjx1LO3PL3DsKopohA=", "narHash": "sha256-j8iB0Yr4zAvQLueCZ5abxfk6fnG/SJ5JnGUziETjwfg=",
"owner": "ipetkov", "owner": "ipetkov",
"repo": "crane", "repo": "crane",
"rev": "323b5746d89e04b22554b061522dfce9e4c49b18", "rev": "d9e753122e51cee64eb8d2dddfe11148f339f5a2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -22,11 +22,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1750683087, "lastModified": 1770643227,
"narHash": "sha256-CkmobghX9K9soC4DoorFo/vlWXxpf8xuZyoCsOnWzqM=", "narHash": "sha256-Dhl7sU33nociCpvK51Dc6Kr3c3g6e37GiaQ8RsdhaiE=",
"owner": "nix-community", "owner": "nix-community",
"repo": "flakelight", "repo": "flakelight",
"rev": "aa93e0e1ecdccc70c7a185f60c562effbfe3c8d9", "rev": "06f0fad6089dbc5cff57607c9ed4ee01dea00c90",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -44,11 +44,11 @@
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
}, },
"locked": { "locked": {
"lastModified": 1750254239, "lastModified": 1764619631,
"narHash": "sha256-RRhboiUiw4o4hPhxTTnUcd2+8yOLdt6hOTDraMPE/rg=", "narHash": "sha256-WojMP5S9qLmOLecEQ+7+yc33Ly1ydoRsODNG6hlLqiQ=",
"ref": "refs/heads/main", "ref": "refs/heads/main",
"rev": "b7201d4a2220de413e6426c405b69839f6130d1c", "rev": "0fae557bf52d8493840aca52d433c473ecc305ef",
"revCount": 53, "revCount": 67,
"type": "git", "type": "git",
"url": "https://codeberg.org/icewind/mill-scale" "url": "https://codeberg.org/icewind/mill-scale"
}, },
@ -59,16 +59,16 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1750622754, "lastModified": 1770617025,
"narHash": "sha256-kMhs+YzV4vPGfuTpD3mwzibWUE6jotw5Al2wczI0Pv8=", "narHash": "sha256-1jZvgZoAagZZB6NwGRv2T2ezPy+X6EFDsJm+YSlsvEs=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "c7ab75210cb8cb16ddd8f290755d9558edde7ee1", "rev": "2db38e08fdadcc0ce3232f7279bab59a15b94482",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "id": "nixpkgs",
"ref": "nixos-25.05", "ref": "nixos-25.11",
"type": "indirect" "type": "indirect"
} }
}, },
@ -88,11 +88,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1750214276, "lastModified": 1764557621,
"narHash": "sha256-1kniuhH70q4TAC/xIvjFYH46aHiLrbIlcr6fdrRwO1A=", "narHash": "sha256-kX5PoY8hQZ80+amMQgOO9t8Tc1JZ70gYRnzaVD4AA+o=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "f9b2b2b1327ff6beab4662b8ea41689e0a57b8d4", "rev": "93316876c2229460a5d6f5f052766cc4cef538ce",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -1,6 +1,6 @@
{ {
inputs = { inputs = {
nixpkgs.url = "nixpkgs/nixos-25.05"; nixpkgs.url = "nixpkgs/nixos-25.11";
flakelight = { flakelight = {
url = "github:nix-community/flakelight"; url = "github:nix-community/flakelight";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";

View file

@ -75,7 +75,6 @@ impl TryFrom<RawMqttConfig> for MqttConfig {
} }
} }
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum ConfigError { pub enum ConfigError {
#[error("Failed to read config file {}: {error:#}", path.display())] #[error("Failed to read config file {}: {error:#}", path.display())]

View file

@ -67,8 +67,8 @@ async fn main() -> MainResult {
loop { loop {
let notification = event_loop.poll().await?; let notification = event_loop.poll().await?;
if let Event::Incoming(Packet::Publish(packet)) = notification { if let Event::Incoming(Packet::Publish(packet)) = notification
if let Some(triggered) = packet && let Some(triggered) = packet
.topic .topic
.as_str() .as_str()
.strip_prefix("tele/") .strip_prefix("tele/")
@ -86,7 +86,6 @@ async fn main() -> MainResult {
} }
} }
} }
}
} }
struct Switch { struct Switch {
@ -130,5 +129,12 @@ async fn flash(mqtt_client: Arc<AsyncClient>, switch: Arc<Switch>) {
async fn toggle_light(mqtt_client: &AsyncClient, light: &str) -> Result<(), ClientError> { async fn toggle_light(mqtt_client: &AsyncClient, light: &str) -> Result<(), ClientError> {
debug!(light, "toggling light"); debug!(light, "toggling light");
mqtt_client.publish(format!("cmnd/{light}/POWER"), QoS::ExactlyOnce, false, "toggle").await mqtt_client
.publish(
format!("cmnd/{light}/POWER"),
QoS::ExactlyOnce,
false,
"toggle",
)
.await
} }