1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00

feat(i3status-rust): add sun timer

This commit is contained in:
2021-10-19 17:59:14 +02:00
parent 3545c37084
commit b43de46611

View File

@@ -92,6 +92,16 @@ in {
units = "metric";
};
}
{
block = "custom";
interval = 60 * 60;
command = let inherit (import <niveum/configs/spacetime.nix>) location; in pkgs.writers.writeDash "sun-times" ''
result="$(${pkgs.curl}/bin/curl -sSL "https://api.sunrise-sunset.org/json?formatted=0&lat=${toString location.latitude}&lng=${toString location.longitude}")"
sunrise="$(echo "$result" | ${pkgs.jq}/bin/jq -r .results.sunrise)"
sunset="$(echo "$result" | ${pkgs.jq}/bin/jq -r .results.sunset)"
echo "🌅 $(${pkgs.coreutils}/bin/date +%R -d "$sunrise") 🌇 $(${pkgs.coreutils}/bin/date +%R -d "$sunset")"
'';
}
{
block = "custom";
interval = 60 * 60;