1
0
mirror of https://github.com/kmein/niveum synced 2026-03-22 21:01:07 +01:00

feat(panoptikon): setup in different service

This commit is contained in:
2023-03-27 09:27:44 +02:00
parent 96d44a52f0
commit fada909105

View File

@@ -71,9 +71,29 @@
}) })
cfg.watchers; cfg.watchers;
systemd.services = lib.attrsets.mapAttrs' (watcherName: watcherOptions: systemd.services =
{
setup-panoptikon = {
enable = true;
wantedBy = ["multi-user.target"];
serviceConfig = {
Type = "oneshot";
User = "panoptikon";
Group = "panoptikon";
WorkingDirectory = "/var/lib/panoptikon";
Restart = "on-failure";
};
script = ''
${pkgs.git}/bin/git init --quiet
${pkgs.git}/bin/git config user.email "panoptikon@${config.networking.hostName}"
${pkgs.git}/bin/git config user.name Panoptikon
'';
};
}
// lib.attrsets.mapAttrs' (watcherName: watcherOptions:
lib.nameValuePair "panoptikon-${watcherName}" { lib.nameValuePair "panoptikon-${watcherName}" {
enable = true; enable = true;
after = ["setup-panoptikon.service"];
startAt = watcherOptions.frequency; startAt = watcherOptions.frequency;
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
@@ -92,10 +112,6 @@
script = '' script = ''
set -efux set -efux
${pkgs.git}/bin/git init --quiet
${pkgs.git}/bin/git config user.email "panoptikon@${config.networking.hostName}"
${pkgs.git}/bin/git config user.name Panoptikon
${watcherOptions.script} > ${watcherName} ${watcherOptions.script} > ${watcherName}
${pkgs.git}/bin/git add ${watcherName} ${pkgs.git}/bin/git add ${watcherName}
${pkgs.git}/bin/git commit --message "$(${pkgs.coreutils}/bin/date -Is)" || : ${pkgs.git}/bin/git commit --message "$(${pkgs.coreutils}/bin/date -Is)" || :