121 lines
2.9 KiB
Nix
121 lines
2.9 KiB
Nix
{ lib, config, inputs, pkgs, ... }:
|
|
with lib;
|
|
let
|
|
cfg = config.modules.dav;
|
|
secretsDirectory = "${(builtins.toString inputs.nix-private)}/secrets";
|
|
vdirsyncerConf = {
|
|
enable = true;
|
|
auth = "basic";
|
|
};
|
|
in
|
|
{
|
|
options.modules.dav = {
|
|
enable = mkEnableOption "enable personal Caldav / CardDav";
|
|
};
|
|
config = mkIf cfg.enable {
|
|
|
|
sops = {
|
|
secrets = {
|
|
"${inputs.nix-private.dav.personal.secret.key}" = {
|
|
sopsFile = "${secretsDirectory}/${inputs.nix-private.dav.personal.secret.file}";
|
|
};
|
|
};
|
|
};
|
|
|
|
accounts.calendar.basePath = ".local/share/calendars";
|
|
accounts.calendar.accounts.personal_calendars = {
|
|
name = "personal_calendar";
|
|
remote = {
|
|
type = "caldav";
|
|
url = inputs.nix-private.dav.personal.caldavUrl;
|
|
userName = inputs.nix-private.dav.personal.userName;
|
|
passwordCommand = [
|
|
"${pkgs.coreutils}/bin/cat"
|
|
"${config.sops.secrets."${inputs.nix-private.dav.personal.secret.key}".path}"
|
|
];
|
|
};
|
|
vdirsyncer = vdirsyncerConf // {
|
|
metadata = [
|
|
"color"
|
|
"displayname"
|
|
];
|
|
itemTypes = [
|
|
"VTODO"
|
|
"VEVENT"
|
|
];
|
|
collections = [
|
|
"from a"
|
|
"from b"
|
|
];
|
|
};
|
|
khal = {
|
|
enable = true;
|
|
type = "discover";
|
|
color = "auto";
|
|
};
|
|
};
|
|
|
|
accounts.contact.basePath = ".local/share/contacts";
|
|
accounts.contact.accounts.personal_contacts = {
|
|
remote = {
|
|
type = "carddav";
|
|
url = inputs.nix-private.dav.personal.carddavUrl;
|
|
userName = inputs.nix-private.dav.personal.userName;
|
|
passwordCommand = [
|
|
"${pkgs.coreutils}/bin/cat"
|
|
"${config.sops.secrets."${inputs.nix-private.dav.personal.secret.key}".path}"
|
|
];
|
|
};
|
|
local = {
|
|
type = "filesystem";
|
|
fileExt = ".vcf";
|
|
};
|
|
vdirsyncer = vdirsyncerConf // {
|
|
metadata = [
|
|
"displayname"
|
|
];
|
|
};
|
|
khal = {
|
|
enable = true;
|
|
color = "#26A269";
|
|
};
|
|
khard = {
|
|
enable = true;
|
|
};
|
|
};
|
|
programs.vdirsyncer.enable = true;
|
|
services.vdirsyncer = {
|
|
enable = true;
|
|
frequency = "*:0/15";
|
|
};
|
|
programs.khal = {
|
|
enable = true;
|
|
locale = {
|
|
dateformat = "%Y.%m.%d";
|
|
datetimeformat = "%Y.%m.%d %H:%M";
|
|
longdateformat = "%d %B %Y";
|
|
longdatetimeformat = "%d %B %Y %H:%M";
|
|
timeformat = "%H:%M";
|
|
};
|
|
settings = {
|
|
default = {
|
|
highlight_event_days = true;
|
|
};
|
|
view = {
|
|
frame = "color";
|
|
blank_line_before_day = true;
|
|
};
|
|
};
|
|
};
|
|
programs.khard = {
|
|
enable = true;
|
|
settings = {
|
|
general = {
|
|
default_action = "list";
|
|
editor = ["nvim" "-i" "NONE"];
|
|
merge_editor = [ "nvim" "-d" ];
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|