summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2025-04-17 17:18:19 -0600
committerAlejandro Soto <alejandro@34project.org>2025-04-19 11:10:00 -0600
commitc85e8fe37d06358b06674020899e920f5fb1818b (patch)
tree8d60c30e9e9f909e74397bb68af73b3858d503f6
parent686e6e85e83770dc3ab18613ad5dad50ed59dda8 (diff)
home/pim: enable Xandikos DAV server
Diffstat (limited to '')
-rw-r--r--home/pim/dav.nix50
-rw-r--r--home/pim/default.nix1
-rw-r--r--pkgs/default.nix1
-rw-r--r--pkgs/xandikos/default.nix6
4 files changed, 58 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" ];
+ };
+ };
+ };
+ };
+}
diff --git a/home/pim/default.nix b/home/pim/default.nix
index 47b4a41..b8afc81 100644
--- a/home/pim/default.nix
+++ b/home/pim/default.nix
@@ -1,5 +1,6 @@
{
imports = [
+ ./dav.nix
./mail.nix
./syncthing.nix
];
diff --git a/pkgs/default.nix b/pkgs/default.nix
index 4de6906..32747f1 100644
--- a/pkgs/default.nix
+++ b/pkgs/default.nix
@@ -49,6 +49,7 @@ in
};
postfix = callPackage ./postfix { inherit (prev) postfix; };
+ xandikos = final.python3Packages.callPackage ./xandikos { inherit (prev) xandikos; };
} // (
let
makePyOverrides = version:
diff --git a/pkgs/xandikos/default.nix b/pkgs/xandikos/default.nix
new file mode 100644
index 0000000..0810efa
--- /dev/null
+++ b/pkgs/xandikos/default.nix
@@ -0,0 +1,6 @@
+{ xandikos
+, systemd
+}:
+xandikos.overridePythonAttrs (super: {
+ dependencies = super.dependencies ++ [ systemd ];
+})