de.p1st.monitor timer

This commit is contained in:
Daniel Langbein 2023-10-08 16:35:02 +02:00
parent e22978b758
commit a5db5f870d
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002

View File

@ -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