summaryrefslogtreecommitdiff
path: root/home/pim/dav.nix
diff options
context:
space:
mode:
Diffstat (limited to 'home/pim/dav.nix')
-rw-r--r--home/pim/dav.nix50
1 files changed, 50 insertions, 0 deletions
diff --git a/home/pim/dav.nix b/home/pim/dav.nix
new file mode 100644
index 0000000..c19b2ed
--- /dev/null
+++ b/home/pim/dav.nix
@@ -0,0 +1,50 @@
+{ config, lib, pkgs, ... }:
+with lib; let
+ cfg = config.local.dav;
+in
+{
+ options.local.dav = with types; {
+ enable = mkEnableOption "Web/Card/CalDAV";
+ };
+
+ config = mkIf cfg.enable {
+ systemd.user = {
+ services.xandikos = {
+ Unit = {
+ Description = "Xandikos CalDAV/CardDAV server";
+ };
+
+ Service = {
+ ExecStart = escapeShellArgs [
+ (getExe pkgs.xandikos)
+ "-d"
+ "${config.home.homeDirectory}/dav"
+ "--route-prefix"
+ "/${config.home.username}/dav"
+ "--current-user-principal"
+ "/user/"
+ # Hacerlo fallar si no agarra systemd socket activation por cualquier motivo
+ "-p"
+ "1"
+ ];
+
+ Type = "simple";
+ };
+ };
+
+ sockets.xandikos = {
+ Unit = {
+ Description = "Xandikos socket";
+ };
+
+ Socket = {
+ ListenStream = "/run/host-www/ale/dav.sock";
+ };
+
+ Install = {
+ WantedBy = [ "sockets.target" ];
+ };
+ };
+ };
+ };
+}