From c3a5e5f0df6f53aa4b51adc0107796cc407c641c Mon Sep 17 00:00:00 2001 From: Anton Mosich Date: Sun, 19 Oct 2025 21:33:15 +0200 Subject: [PATCH] services/pimsync: init services/pimsync: add documentation --- modules/services/pimsync.nix | 67 ++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 modules/services/pimsync.nix diff --git a/modules/services/pimsync.nix b/modules/services/pimsync.nix new file mode 100644 index 000000000..99eac8d1d --- /dev/null +++ b/modules/services/pimsync.nix @@ -0,0 +1,67 @@ +{ + lib, + pkgs, + config, + ... +}: +let + cfg = config.services.pimsync; +in +{ + meta.maintainers = [ lib.maintainers.antonmosich ]; + + options.services.pimsync = { + enable = lib.mkEnableOption "pimsync"; + + package = lib.mkPackageOption pkgs "pimsync" { }; + + configFile = lib.mkOption { + type = lib.types.nullOr lib.types.path; + default = null; + description = '' + Optional configuration file to use instead of the default file + ({file}`$XDG_CONFIG_HOME/pimsync/pimsync.conf`). + ''; + }; + + verbosity = lib.mkOption { + type = lib.types.enum [ + "trace" + "debug" + "info" + "warn" + "error" + ]; + description = "The verbosity in which pimsync should log."; + default = "warn"; + }; + }; + + config = lib.mkIf cfg.enable { + systemd.user.services.pimsync = { + Unit = { + Description = "pimsync calendar and contacts synchronization"; + PartOf = [ "network-online.target" ]; + }; + Service = { + # TODO: make use of the readiness notification + Type = "simple"; + + ExecStart = + let + command = [ + (lib.getExe cfg.package) + "-v" + cfg.verbosity + ] + ++ lib.optionals (cfg.configFile != null) [ + "-c" + cfg.configFile + ] + ++ [ "daemon" ]; + in + lib.concatStringsSep " " command; + }; + }; + }; +}