taskwarrior-pushover use dynamic user
This commit is contained in:
parent
3acf05147a
commit
289d502c41
2 changed files with 25 additions and 10 deletions
|
@ -1,14 +1,17 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
sops.secrets.pushoverApiToken = {};
|
users.users."taskwarrior-pushover".isSystemUser = true;
|
||||||
sops.secrets.pushoverUserKey = {};
|
|
||||||
sops.secrets.taskwarriorCa = {};
|
sops.secrets.pushoverApiToken.owner = "taskwarrior-pushover";
|
||||||
sops.secrets.taskwarriorCertificate = {};
|
sops.secrets.pushoverUserKey.owner = "taskwarrior-pushover";
|
||||||
sops.secrets.taskwarriorKey = {};
|
sops.secrets.taskwarriorCa.owner = "taskwarrior-pushover";
|
||||||
|
sops.secrets.taskwarriorCertificate.owner = "taskwarrior-pushover";
|
||||||
|
sops.secrets.taskwarriorKey.owner = "taskwarrior-pushover";
|
||||||
|
|
||||||
services.taskwarrior-pushover = {
|
services.taskwarrior-pushover = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
onCalendar = "06:30:00";
|
||||||
server = "taskd.ingolf-wagner.de:53589";
|
server = "taskd.ingolf-wagner.de:53589";
|
||||||
pushoverApiTokenFile = config.sops.secrets.pushoverApiToken.path;
|
pushoverApiTokenFile = config.sops.secrets.pushoverApiToken.path;
|
||||||
pushoverUserKeyFile = config.sops.secrets.pushoverUserKey.path;
|
pushoverUserKeyFile = config.sops.secrets.pushoverUserKey.path;
|
||||||
|
|
|
@ -4,10 +4,15 @@ with lib;
|
||||||
with types;
|
with types;
|
||||||
let
|
let
|
||||||
cfg = config.services.taskwarrior-pushover;
|
cfg = config.services.taskwarrior-pushover;
|
||||||
|
name = "taskwarrior-pushover";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.services.taskwarrior-pushover = {
|
options.services.taskwarrior-pushover = {
|
||||||
enable = mkEnableOption "taskwarrior pushover notification service";
|
enable = mkEnableOption "taskwarrior pushover notification service";
|
||||||
|
onCalendar = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "4:00:00";
|
||||||
|
};
|
||||||
pushoverApiTokenFile = mkOption {
|
pushoverApiTokenFile = mkOption {
|
||||||
type = path;
|
type = path;
|
||||||
};
|
};
|
||||||
|
@ -20,7 +25,7 @@ in
|
||||||
};
|
};
|
||||||
dataDir = mkOption {
|
dataDir = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
default = "/var/lib/taskwarrior-pushover";
|
default = "tasks";
|
||||||
};
|
};
|
||||||
caFile = mkOption {
|
caFile = mkOption {
|
||||||
type = path;
|
type = path;
|
||||||
|
@ -42,14 +47,16 @@ in
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
systemd.services.taskwarrior-pushover = {
|
systemd.services.taskwarrior-pushover = {
|
||||||
enable = true;
|
enable = true;
|
||||||
#serviceConfig = {
|
serviceConfig = {
|
||||||
# DynamicUser = true;
|
DynamicUser = true;
|
||||||
#};
|
StateDirectory = name;
|
||||||
|
};
|
||||||
script = let
|
script = let
|
||||||
taskwarriorCommand = pkgs.writers.writeDash "taskwarrior-push" ''
|
taskwarriorCommand = pkgs.writers.writeDash "taskwarrior-push" ''
|
||||||
${pkgs.taskwarrior}/bin/task \
|
${pkgs.taskwarrior}/bin/task \
|
||||||
rc.recurrence=off \
|
rc.recurrence=off \
|
||||||
rc.data.location=${cfg.dataDir} \
|
rc:/var/lib/${name}/.taskrc \
|
||||||
|
rc.data.location=/var/lib/${name}/${cfg.dataDir} \
|
||||||
rc.taskd.ca=${cfg.caFile} \
|
rc.taskd.ca=${cfg.caFile} \
|
||||||
rc.taskd.certificate=${cfg.certificateFile} \
|
rc.taskd.certificate=${cfg.certificateFile} \
|
||||||
rc.taskd.credentials="${cfg.credentials}" \
|
rc.taskd.credentials="${cfg.credentials}" \
|
||||||
|
@ -83,6 +90,11 @@ in
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
systemd.timers.taskwarrior-pushover = {
|
||||||
|
enable = true;
|
||||||
|
timerConfig.OnCalendar = cfg.onCalendar;
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue