mirror of
https://codeberg.org/privacy1st/nix-git
synced 2024-12-23 02:36:05 +01:00
refactor de-p1st-monitor
This commit is contained in:
parent
954ce4c5dd
commit
59a4567289
@ -51,6 +51,7 @@
|
||||
#../../modules/ntfs.nix
|
||||
#../../modules/veracrypt.nix
|
||||
../../modules/btrbk
|
||||
../../modules/de-p1st-monitor.nix
|
||||
../../modules/spin-down.nix
|
||||
|
||||
../../modules/btrfs-scrub.nix
|
||||
|
@ -22,37 +22,13 @@ let
|
||||
];
|
||||
}
|
||||
)
|
||||
# de-p1st-monitor is not (yet) packaged, thus we build it from PyPI
|
||||
(
|
||||
buildPythonPackage rec {
|
||||
pname = "de.p1st.monitor";
|
||||
version = "0.11.2";
|
||||
# https://nixos.wiki/wiki/Packaging/Python#Fix_Missing_setup.py
|
||||
format = "pyproject";
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "sha256-8rrDuG893gz4B83R8C5U+3AQLK3rPpPoJTTi+C7BL9o=";
|
||||
};
|
||||
propagatedBuildInputs = [
|
||||
# Dependencies
|
||||
pkgs.python3Packages.psutil
|
||||
# Build dependencies
|
||||
build
|
||||
twine
|
||||
];
|
||||
}
|
||||
)
|
||||
];
|
||||
in
|
||||
{
|
||||
# Install de.p1st.monitor and netcup-dns Python packages.
|
||||
# Install netcup-dns Python packages.
|
||||
environment.systemPackages = [
|
||||
(pkgs.python3.withPackages my-python-packages)
|
||||
# Dependency of de.p1st.monitor.
|
||||
pkgs.smartmontools
|
||||
];
|
||||
# Dependency of de.p1st.monitor
|
||||
boot.kernelModules = [ "drivetemp" ];
|
||||
|
||||
# Configure netcup-dns.
|
||||
# Create file `/etc/netcup-dns/netcup-dns-95191.json`.
|
||||
@ -92,35 +68,6 @@ 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
|
||||
];
|
||||
};
|
||||
|
||||
# Update and start Jinja-Compose project
|
||||
# during boot and after every 30 minutes.
|
||||
# To view the log, run
|
||||
|
Loading…
Reference in New Issue
Block a user