Add vdirsync and khal with small notification script
Very basic, but maybe better then all the shiny none working solutions. Will sync all calendars to vdir. khal is able to parse and show them. khal also offers an cli interface to fetch events for a certain time. Properly use keepass xc via secret tool as command line tool Enable keepassxc usage as secret tool. Remove crypted file as this no longer keeps passwords Remove korganizer as it doesn't provide notifications, try khal
This commit is contained in:
parent
3c3c875ff6
commit
cc3fcb3d50
2
home.nix
2
home.nix
|
@ -4,6 +4,8 @@
|
|||
|
||||
imports = [
|
||||
./home/modules/programs/cmus.nix
|
||||
./home/modules/programs/vdirsyncer.nix
|
||||
./home/modules/programs/khal.nix
|
||||
./home/modules/programs/languagetool.nix
|
||||
./home/modules/programs/mailhog.nix
|
||||
./home/modules/programs/signald.nix
|
||||
|
|
80
home/modules/programs/khal.nix
Normal file
80
home/modules/programs/khal.nix
Normal file
|
@ -0,0 +1,80 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.programs.khal;
|
||||
|
||||
# TODO: Make more compatible, e.g. provide notify from outside and add checks whether to use or not.
|
||||
# Maybe create small php script instead which parses the khal output and checks for beginning
|
||||
notificationScript = pkgs.writeShellApplication {
|
||||
name = "khal-notification";
|
||||
text = ''
|
||||
date=$(date "+%H:%M:00")
|
||||
events=$(${pkgs.khal}/bin/khal list --notstarted "$date" "$1")
|
||||
if [ -z "$events" ]; then
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
notify-send -u critical "Upcoming Events" "$events"
|
||||
exit 0
|
||||
'';
|
||||
};
|
||||
|
||||
in {
|
||||
options.programs.khal = {
|
||||
enable = mkEnableOption "khal";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.khal;
|
||||
description = "khal package to install.";
|
||||
};
|
||||
|
||||
frequency = mkOption {
|
||||
type = types.str;
|
||||
default = "*:0/15";
|
||||
example = "hourly";
|
||||
description = ''
|
||||
The notification frequency.
|
||||
Check <literal>man systemd.time</literal> for more information on the syntax.
|
||||
'';
|
||||
};
|
||||
|
||||
time_delta = mkOption {
|
||||
type = types.str;
|
||||
default = "15m";
|
||||
example = "15m";
|
||||
description = "The delta to pass to khal list.";
|
||||
};
|
||||
|
||||
configuration = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
description = ''
|
||||
The content of the configuration file.
|
||||
See: https://lostpackets.de/khal/configure.html
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile."khal/config".text = cfg.configuration;
|
||||
|
||||
systemd.user.services.khal_notification = {
|
||||
Unit = { Description = "khal notification"; };
|
||||
Service = { ExecStart = "${notificationScript}/bin/khal-notification \"${cfg.time_delta}\""; };
|
||||
};
|
||||
|
||||
systemd.user.timers.khal_notification = {
|
||||
Unit = { Description = "khal notification"; };
|
||||
Timer = {
|
||||
OnCalendar = "${cfg.frequency}";
|
||||
Unit = "khal_notification.service";
|
||||
};
|
||||
Install = { WantedBy = [ "timers.target" ]; };
|
||||
};
|
||||
};
|
||||
}
|
60
home/modules/programs/vdirsyncer.nix
Normal file
60
home/modules/programs/vdirsyncer.nix
Normal file
|
@ -0,0 +1,60 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.programs.vdirsyncer;
|
||||
in {
|
||||
options.programs.vdirsyncer = {
|
||||
enable = mkEnableOption "vdirsyncer";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.vdirsyncer;
|
||||
description = "vdirsyncer package to install.";
|
||||
};
|
||||
|
||||
frequency = mkOption {
|
||||
type = types.str;
|
||||
default = "*:0/15";
|
||||
example = "hourly";
|
||||
description = ''
|
||||
The sync frequency.
|
||||
Check <literal>man systemd.time</literal> for more information on the syntax.
|
||||
'';
|
||||
};
|
||||
|
||||
configuration = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
description = ''
|
||||
The content of the configuration file.
|
||||
See:
|
||||
- https://vdirsyncer.pimutils.org/en/stable/tutorial.html#configuration
|
||||
- https://github.com/pimutils/vdirsyncer/blob/main/config.example
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile."vdirsyncer/config".text = cfg.configuration;
|
||||
|
||||
systemd.user.services.vdirsyncer = {
|
||||
Unit = { Description = "vdirsyncer synchronisation"; };
|
||||
Service = { ExecStart = "${pkgs.vdirsyncer}/bin/vdirsyncer sync"; };
|
||||
};
|
||||
|
||||
systemd.user.timers.vdirsyncer = {
|
||||
Unit = { Description = "vdirsyncer synchronisation"; };
|
||||
Timer = {
|
||||
OnBootSec = "15min";
|
||||
OnCalendar = "${cfg.frequency}";
|
||||
Persistent = true;
|
||||
Unit = "vdirsyncer.service";
|
||||
};
|
||||
Install = { WantedBy = [ "timers.target" ]; };
|
||||
};
|
||||
};
|
||||
}
|
|
@ -63,7 +63,6 @@ with pkgs; [
|
|||
|
||||
# Communication
|
||||
evolution
|
||||
libsForQt5.korganizer
|
||||
|
||||
# Media
|
||||
vlc
|
||||
|
|
|
@ -49,6 +49,13 @@ in {
|
|||
firefox = import ./programs/firefox.nix {
|
||||
};
|
||||
|
||||
vdirsyncer = import ./programs/vdirsyncer.nix {
|
||||
inherit config pkgs;
|
||||
};
|
||||
khal = import ./programs/khal.nix {
|
||||
inherit config;
|
||||
};
|
||||
|
||||
# Media
|
||||
cmus.enable = true;
|
||||
}
|
||||
|
|
33
home/programs/khal.nix
Normal file
33
home/programs/khal.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{ config }:
|
||||
|
||||
{
|
||||
enable = true;
|
||||
|
||||
configuration = ''
|
||||
[calendars]
|
||||
|
||||
[[private]]
|
||||
path = ${config.xdg.dataHome}/vdir/calendars/private/personal
|
||||
color = dark blue
|
||||
[[arbeit]]
|
||||
path = ${config.xdg.dataHome}/vdir/calendars/private/imported-arbeitics
|
||||
color = dark red
|
||||
[[birthdays]]
|
||||
path = ${config.xdg.dataHome}/vdir/calendars/private/contact_birthdays
|
||||
color = dark green
|
||||
[[typo3]]
|
||||
path = ${config.xdg.dataHome}/vdir/calendars/private/typo3
|
||||
color = #FFE377
|
||||
|
||||
[[work]]
|
||||
path = ${config.xdg.dataHome}/vdir/calendars/company/personal
|
||||
color = dark red
|
||||
[[sac_scrum_team]]
|
||||
path = ${config.xdg.dataHome}/vdir/calendars/company/sac-scrum-team-synced
|
||||
color = dark red
|
||||
|
||||
[locale]
|
||||
local_timezone= Europe/Berlin
|
||||
default_timezone= Europe/Berlin
|
||||
'';
|
||||
}
|
57
home/programs/vdirsyncer.nix
Normal file
57
home/programs/vdirsyncer.nix
Normal file
|
@ -0,0 +1,57 @@
|
|||
{ pkgs, config }:
|
||||
|
||||
{
|
||||
enable = true;
|
||||
|
||||
frequency = "Mon..Thu *-*-* 15,12,8:00";
|
||||
|
||||
configuration = ''
|
||||
[general]
|
||||
status_path = "${config.xdg.dataHome}/vdirsyncer/status/"
|
||||
|
||||
[pair private_calendar]
|
||||
a = "private_calendar_local"
|
||||
b = "private_calendar_remote"
|
||||
collections = ["from a", "from b"]
|
||||
[storage private_calendar_local]
|
||||
type = "filesystem"
|
||||
path = "${config.xdg.dataHome}/vdir/calendars/private/"
|
||||
fileext = ".ics"
|
||||
[storage private_calendar_remote]
|
||||
type = "caldav"
|
||||
url = "https://nextcloud.daniel-siepmann.de/remote.php/dav"
|
||||
username = "dsiepmann"
|
||||
password.fetch = ["command", "${pkgs.libsecret}/bin/secret-tool", "lookup", "account", "app-dsiepmann@nextcloud.daniel-siepmann.de"]
|
||||
start_date = "datetime.now() - timedelta(days=60)"
|
||||
end_date = "datetime.now() + timedelta(days=365)"
|
||||
|
||||
[pair company_calendar]
|
||||
a = "company_calendar_local"
|
||||
b = "company_calendar_remote"
|
||||
collections = ["from a", "from b"]
|
||||
[storage company_calendar_local]
|
||||
type = "filesystem"
|
||||
path = "${config.xdg.dataHome}/vdir/calendars/company/"
|
||||
fileext = ".ics"
|
||||
[storage company_calendar_remote]
|
||||
type = "caldav"
|
||||
url = "https://nextcloud.codappix.com/remote.php/dav"
|
||||
username = "daniel.siepmann"
|
||||
password.fetch = ["command", "${pkgs.libsecret}/bin/secret-tool", "lookup", "account", "app-dsiepmann@nextcloud.codapix.com"]
|
||||
start_date = "datetime.now() - timedelta(days=60)"
|
||||
end_date = "datetime.now() + timedelta(days=365)"
|
||||
|
||||
[pair sac_team]
|
||||
a = "sac_team_calendar_private"
|
||||
b = "sac_team_calendar_public"
|
||||
collections = null
|
||||
[storage sac_team_calendar_private]
|
||||
type = "caldav"
|
||||
url = "https://nextcloud.codappix.com/remote.php/dav/calendars/daniel.siepmann/sac-scrum-team-synced/"
|
||||
username = "daniel.siepmann"
|
||||
password.fetch = ["command", "${pkgs.libsecret}/bin/secret-tool", "lookup", "account", "app-dsiepmann@nextcloud.codapix.com"]
|
||||
[storage sac_team_calendar_public]
|
||||
type = "http"
|
||||
url = "https://calendar.google.com/calendar/ical/0ks410dho8f5ohcik361i4c2bs%40group.calendar.google.com/public/basic.ics"
|
||||
'';
|
||||
}
|
|
@ -17,6 +17,10 @@
|
|||
ConfigVersion = 2;
|
||||
};
|
||||
|
||||
FdoSecrets = {
|
||||
Enabled = true;
|
||||
};
|
||||
|
||||
GUI = {
|
||||
ApplicationTheme = "dark";
|
||||
CompactMode = true;
|
||||
|
|
Loading…
Reference in a new issue