Testing forecast weather scripts

This commit is contained in:
Danilo Reyes 2023-05-16 20:12:31 -06:00
parent d1695430b0
commit 900d62a98b
2 changed files with 117 additions and 2 deletions

View File

@ -8,6 +8,10 @@ let
unstable = import UNSTABLE_TARBALL { config = config.nixpkgs.config; }; unstable = import UNSTABLE_TARBALL { config = config.nixpkgs.config; };
nextcloud_scrapsync = pkgs.writeScriptBin "nextcloud_scrapsync" nextcloud_scrapsync = pkgs.writeScriptBin "nextcloud_scrapsync"
(builtins.readFile ./scripts/nextcloud_scrapsync.sh); (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" manage_library = pkgs.writeScriptBin "manage_library"
(builtins.readFile ./scripts/manage_library.fish); (builtins.readFile ./scripts/manage_library.fish);
ffmpeg4discord = pkgs.writeScriptBin "ffmpeg4discord" ffmpeg4discord = pkgs.writeScriptBin "ffmpeg4discord"
@ -186,6 +190,9 @@ in { # Remember to close this bracket at the end of the document
nextcloud_scrapsync nextcloud_scrapsync
ffmpeg4discord ffmpeg4discord
manage_library manage_library
mateo-current
mateo-forecast
jq
# required by doom emacs, but still are rather useful. # required by doom emacs, but still are rather useful.
fd # modern find, faster searches 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 ]; path = [ pkgs.docker-compose ];
serviceConfig = { serviceConfig = {
Restart = "on-failure"; Restart = "on-failure";
# Type = "simple";
RestartSec = 30; RestartSec = 30;
ExecStart = ExecStart =
"${pkgs.docker-compose}/bin/docker-compose -f \${FILE} up --remove-orphans"; "${pkgs.docker-compose}/bin/docker-compose -f \${FILE} up --remove-orphans";
ExecStop = "${pkgs.docker-compose}/bin/docker-compose -f \${FILE} down"; 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" = { "nextcloud_scrapsync" = {
description = "Sync scrapped files with nextcloud"; description = "Sync scrapped files with nextcloud";
wantedBy = [ "default.target" ]; wantedBy = [ "default.target" ];
@ -630,6 +660,27 @@ in { # Remember to close this bracket at the end of the document
Persistent = true; 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 = { systemd.user.services = {
"HentaiAtHome" = { "HentaiAtHome" = {

View File

@ -50,6 +50,10 @@ let
}; };
nextcloud_scrapsync = pkgs.writeScriptBin nextcloud_scrapsync = pkgs.writeScriptBin
"nextcloud_scrapsync" (builtins.readFile ./scripts/nextcloud_scrapsync.sh); "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 = pkgs.writeScriptBin
"manage_library" (builtins.readFile ./scripts/manage_library.fish); "manage_library" (builtins.readFile ./scripts/manage_library.fish);
ffmpeg4discord = pkgs.writeScriptBin ffmpeg4discord = pkgs.writeScriptBin
@ -370,6 +374,9 @@ lm_sensors # for extension, displays cpu temp
nextcloud_scrapsync nextcloud_scrapsync
ffmpeg4discord ffmpeg4discord
manage_library manage_library
mateo-current
mateo-forecast
jq
#+end_src #+end_src
** DEVELOPMENT PACKAGES ** DEVELOPMENT PACKAGES
@ -910,12 +917,45 @@ systemd.services = {
]; ];
serviceConfig = { serviceConfig = {
Restart = "on-failure"; Restart = "on-failure";
# Type = "simple";
RestartSec = 30; RestartSec = 30;
ExecStart = "${pkgs.docker-compose}/bin/docker-compose -f \${FILE} up --remove-orphans"; ExecStart = "${pkgs.docker-compose}/bin/docker-compose -f \${FILE} up --remove-orphans";
ExecStop = "${pkgs.docker-compose}/bin/docker-compose -f \${FILE} down"; 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" = { "nextcloud_scrapsync" = {
description = "Sync scrapped files with nextcloud"; description = "Sync scrapped files with nextcloud";
wantedBy = [ "default.target" ]; wantedBy = [ "default.target" ];
@ -945,6 +985,30 @@ systemd.timers = {
Persistent = true; 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 = { systemd.user.services = {
"HentaiAtHome" = { "HentaiAtHome" = {