From a5db5f870dd7f311de30c6f78be89a2671f20f21 Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Sun, 8 Oct 2023 16:35:02 +0200 Subject: [PATCH] de.p1st.monitor timer --- hosts/yodaNas/host-specific.nix | 37 +++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/hosts/yodaNas/host-specific.nix b/hosts/yodaNas/host-specific.nix index b7338db..0988ec8 100644 --- a/hosts/yodaNas/host-specific.nix +++ b/hosts/yodaNas/host-specific.nix @@ -26,12 +26,12 @@ let ( buildPythonPackage rec { pname = "de.p1st.monitor"; - version = "0.10.5"; + version = "0.10.6"; # https://nixos.wiki/wiki/Packaging/Python#Fix_Missing_setup.py format = "pyproject"; src = fetchPypi { inherit pname version; - sha256 = "sha256-WF/+oUQjSaQY+p+1uo2i35CciGCKrB4hn9a3m8oEXpI="; + sha256 = "sha256-7RLDkgi/Bp5ceEHBtQQDfEAsUe6F0GzNAr5hL2J4k5o="; }; propagatedBuildInputs = [ # Dependencies @@ -67,12 +67,12 @@ in group = "netcup-dns"; }; # Create netcup-dns daemon user. - users.users.netcup-dns = { + users.users."netcup-dns" = { isSystemUser = true; group = "netcup-dns"; description = "netcup-dns daemon"; }; - users.groups.netcup-dns = {}; + users.groups."netcup-dns" = {}; # Create netcup-dns timer. systemd.timers."netcup-dns" = { wantedBy = [ "timers.target" ]; @@ -96,6 +96,35 @@ in }; }; + # Create de.p1st.monitor timer. + systemd.timers."de.p1st.monitor" = { + wantedBy = [ "timers.target" ]; + partOf = [ "de.p1st.monitor.service" ]; + timerConfig = { + OnBootSec = "0m"; + OnUnitInactiveSec = "3m"; + + AccuracySec = "15s"; + RandomizedDelaySec = "15s"; + }; + }; + systemd.services."de.p1st.monitor" = { + serviceConfig = { + Type = "oneshot"; + PrivateTmp = true; + # `smartctl` requires root to access /dev/* devices and read their temperatures. + User = "root"; + Nice = 19; + IOSchedulingClass = "idle"; + ExecStart = "${pkgs.python3.withPackages my-python-packages}/bin/de-p1st-monitor"; + }; + path = with pkgs; [ + # Provides `findmnt` binary. + libuuid + smartmontools + ]; + }; + # Start Jinja-Compose project during boot. # To few the log, run # journalctl -b -u Jinja-Compose -f