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.nix54
1 files changed, 54 insertions, 0 deletions
diff --git a/home/pim/dav.nix b/home/pim/dav.nix
new file mode 100644
index 0000000..a0759e2
--- /dev/null
+++ b/home/pim/dav.nix
@@ -0,0 +1,54 @@
+{
+ 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"];
+ };
+ };
+ };
+ };
+}