calendar++
This commit is contained in:
@@ -1,18 +1,30 @@
|
||||
{ config, pkgs, user, ... }:
|
||||
let
|
||||
radicale-root = "/var/lib/radicale";
|
||||
web-root = "/var/nginx/webroot";
|
||||
in
|
||||
{
|
||||
environment.systemPackages = with pkgs; let
|
||||
radicale-root = "/var/lib/radicale";
|
||||
web-root = "/var/nginx/webroot";
|
||||
in [
|
||||
(writers.writePython3Bin "nx_cal_pub" {
|
||||
libraries = with python3Packages; [
|
||||
ical
|
||||
ics
|
||||
requests
|
||||
dateutils
|
||||
];
|
||||
flakeIgnore = [ "E302" "E305" "E226" "E501" ];
|
||||
} /*python */ ''
|
||||
systemd.timers."nx_cal_publish" = {
|
||||
enable = true;
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = {
|
||||
OnBootSec = "2m";
|
||||
OnUnitActiveSec = "6h";
|
||||
Unit = "nx_cal_publish.service";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services."nx_cal_publish" = {
|
||||
script = with pkgs; let
|
||||
nx_cal_publish = (writers.writePython3Bin "nx_cal_publish" {
|
||||
libraries = with python3Packages; [
|
||||
ical
|
||||
ics
|
||||
requests
|
||||
dateutils
|
||||
];
|
||||
flakeIgnore = [ "E302" "E305" "E226" "E501" ];
|
||||
} /*python */ ''
|
||||
import pytz
|
||||
import os
|
||||
from ics import Calendar, Event
|
||||
@@ -114,21 +126,9 @@ if __name__ == "__main__":
|
||||
OUTPUT_FILE = "${web-root}/schedule.ics"
|
||||
|
||||
combine_ics_from_directories(DIRECTORIES, OUTPUT_FILE)
|
||||
'')
|
||||
];
|
||||
systemd.timers."nx_cal_publish" = {
|
||||
enable = true;
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = {
|
||||
OnBootSec = "2m";
|
||||
OnUnitActiveSec = "6h";
|
||||
Unit = "nx_cal_publish.service";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services."nx_cal_publish" = {
|
||||
script = ''
|
||||
nx_cal_publish
|
||||
'');
|
||||
in ''
|
||||
${nx_cal_publish}/bin/nx_cal_publish
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
|
||||
Reference in New Issue
Block a user