From 900d62a98b37a933c7ba903b6421559987184280 Mon Sep 17 00:00:00 2001 From: Danilo Reyes Date: Tue, 16 May 2023 20:12:31 -0600 Subject: [PATCH] Testing forecast weather scripts --- configuration.nix | 53 ++++++++++++++++++++++++++++++++++++- configuration.org | 66 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 117 insertions(+), 2 deletions(-) diff --git a/configuration.nix b/configuration.nix index e8f8762..8f79dd4 100644 --- a/configuration.nix +++ b/configuration.nix @@ -8,6 +8,10 @@ let unstable = import UNSTABLE_TARBALL { config = config.nixpkgs.config; }; nextcloud_scrapsync = pkgs.writeScriptBin "nextcloud_scrapsync" (builtins.readFile ./scripts/nextcloud_scrapsync.sh); + mateo-current = pkgs.writeScriptBin "mateo-current" + (builtins.readFile ./scripts/current.sh); + mateo-forecast = pkgs.writeScriptBin "mateo-forecast" + (builtins.readFile ./scripts/forecast.sh); manage_library = pkgs.writeScriptBin "manage_library" (builtins.readFile ./scripts/manage_library.fish); ffmpeg4discord = pkgs.writeScriptBin "ffmpeg4discord" @@ -186,6 +190,9 @@ in { # Remember to close this bracket at the end of the document nextcloud_scrapsync ffmpeg4discord manage_library + mateo-current + mateo-forecast + jq # required by doom emacs, but still are rather useful. fd # modern find, faster searches @@ -597,13 +604,36 @@ in { # Remember to close this bracket at the end of the document path = [ pkgs.docker-compose ]; serviceConfig = { Restart = "on-failure"; - # Type = "simple"; RestartSec = 30; ExecStart = "${pkgs.docker-compose}/bin/docker-compose -f \${FILE} up --remove-orphans"; ExecStop = "${pkgs.docker-compose}/bin/docker-compose -f \${FILE} down"; }; }; + "mateo-current" = { + enable = true; + restartIfChanged = true; + description = "current weather"; + wantedBy = [ "default.target" ]; + path = [ pkgs.bash pkgs.jq pkgs.curl mateo-current ]; + serviceConfig = { + Restart = "on-failure"; + WorkingDirectory = "/home/jawz/Development/Scripts/open-mateo"; + ExecStart = "${mateo-current}/bin/mateo-current"; + }; + }; + "mateo-forecast" = { + enable = true; + restartIfChanged = true; + description = "forecast weather"; + wantedBy = [ "default.target" ]; + path = [ pkgs.bash pkgs.jq pkgs.curl mateo-forecast ]; + serviceConfig = { + Restart = "on-failure"; + WorkingDirectory = "/home/jawz/Development/Scripts/open-mateo"; + ExecStart = "${mateo-forecast}/bin/mateo-forecast"; + }; + }; "nextcloud_scrapsync" = { description = "Sync scrapped files with nextcloud"; wantedBy = [ "default.target" ]; @@ -630,6 +660,27 @@ in { # Remember to close this bracket at the end of the document Persistent = true; }; }; + "mateo-current" = { + enable = true; + description = "Sync scrapped files with nextcloud"; + wantedBy = [ "timers.target" ]; + timerConfig = { + OnBootSec = "1m"; + OnUnitActiveSec = "1h"; + RandomizedDelaySec = 30; + Persistent = true; + }; + }; + "mateo-forecast" = { + enable = true; + description = "Sync scrapped files with nextcloud"; + wantedBy = [ "timers.target" ]; + timerConfig = { + OnCalendar = [ "*-*-* 06:05:00" "*-*-* 18:05:00" ]; + RandomizedDelaySec = 30; + Persistent = true; + }; + }; }; systemd.user.services = { "HentaiAtHome" = { diff --git a/configuration.org b/configuration.org index 080d9e2..957e545 100755 --- a/configuration.org +++ b/configuration.org @@ -50,6 +50,10 @@ let }; nextcloud_scrapsync = pkgs.writeScriptBin "nextcloud_scrapsync" (builtins.readFile ./scripts/nextcloud_scrapsync.sh); + mateo-current = pkgs.writeScriptBin + "mateo-current" (builtins.readFile ./scripts/current.sh); + mateo-forecast = pkgs.writeScriptBin + "mateo-forecast" (builtins.readFile ./scripts/forecast.sh); manage_library = pkgs.writeScriptBin "manage_library" (builtins.readFile ./scripts/manage_library.fish); ffmpeg4discord = pkgs.writeScriptBin @@ -370,6 +374,9 @@ lm_sensors # for extension, displays cpu temp nextcloud_scrapsync ffmpeg4discord manage_library +mateo-current +mateo-forecast +jq #+end_src ** DEVELOPMENT PACKAGES @@ -910,12 +917,45 @@ systemd.services = { ]; serviceConfig = { Restart = "on-failure"; - # Type = "simple"; RestartSec = 30; ExecStart = "${pkgs.docker-compose}/bin/docker-compose -f \${FILE} up --remove-orphans"; ExecStop = "${pkgs.docker-compose}/bin/docker-compose -f \${FILE} down"; }; }; + "mateo-current" = { + enable = true; + restartIfChanged = true; + description = "current weather"; + wantedBy = [ "default.target" ]; + path = [ + pkgs.bash + pkgs.jq + pkgs.curl + mateo-current + ]; + serviceConfig = { + Restart = "on-failure"; + WorkingDirectory="/home/jawz/Development/Scripts/open-mateo"; + ExecStart = "${mateo-current}/bin/mateo-current"; + }; + }; + "mateo-forecast" = { + enable = true; + restartIfChanged = true; + description = "forecast weather"; + wantedBy = [ "default.target" ]; + path = [ + pkgs.bash + pkgs.jq + pkgs.curl + mateo-forecast + ]; + serviceConfig = { + Restart = "on-failure"; + WorkingDirectory="/home/jawz/Development/Scripts/open-mateo"; + ExecStart = "${mateo-forecast}/bin/mateo-forecast"; + }; + }; "nextcloud_scrapsync" = { description = "Sync scrapped files with nextcloud"; wantedBy = [ "default.target" ]; @@ -945,6 +985,30 @@ systemd.timers = { Persistent = true; }; }; + "mateo-current" = { + enable = true; + description = "Sync scrapped files with nextcloud"; + wantedBy = [ "timers.target" ]; + timerConfig = { + OnBootSec = "1m"; + OnUnitActiveSec = "1h"; + RandomizedDelaySec = 30; + Persistent = true; + }; + }; + "mateo-forecast" = { + enable = true; + description = "Sync scrapped files with nextcloud"; + wantedBy = [ "timers.target" ]; + timerConfig = { + OnCalendar= [ + "*-*-* 06:05:00" + "*-*-* 18:05:00" + ]; + RandomizedDelaySec = 30; + Persistent = true; + }; + }; }; systemd.user.services = { "HentaiAtHome" = {