etesync-dav: add module

This commit is contained in:
Vincent Breitmoser 2020-07-21 10:26:48 +02:00 committed by Robert Helgesson
parent f298705ae4
commit 30355f8ee6
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
4 changed files with 73 additions and 1 deletions

2
.github/CODEOWNERS vendored
View file

@ -184,6 +184,8 @@
/modules/services/emacs.nix @tadfisher
/modules/services/etesync-dav.nix @Valodim
/modules/services/flameshot.nix @moredhel
/modules/services/fluidsynth.nix @Valodim

View file

@ -1946,7 +1946,7 @@ in
A new module is available: 'programs.lazygit'.
'';
}
{
time = "2021-04-27T00:00:00+00:00";
message = ''
@ -1954,6 +1954,13 @@ in
'';
}
{
time = "2021-05-06T20:47:37+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.etesync-dav'
'';
}
];
};
}

View file

@ -151,6 +151,7 @@ let
(loadModule ./services/dunst.nix { })
(loadModule ./services/dwm-status.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/emacs.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/etesync-dav.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/flameshot.nix { })
(loadModule ./services/fluidsynth.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/redshift-gammastep/gammastep.nix { condition = hostPlatform.isLinux; })

View file

@ -0,0 +1,62 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.etesync-dav;
toEnvironmentCfg = vars:
(concatStringsSep " "
(mapAttrsToList (k: v: "${k}=${escapeShellArg v}") vars));
in {
meta.maintainers = [ maintainers.valodim ];
options.services.etesync-dav = {
enable = mkEnableOption "etesync-dav";
package = mkOption {
type = types.package;
default = pkgs.etesync-dav;
defaultText = "pkgs.etesync-dav";
description = "The etesync-dav derivation to use.";
};
serverUrl = mkOption {
type = types.str;
default = "https://api.etesync.com/";
description = "The URL to the etesync server.";
};
settings = mkOption {
type = types.attrsOf (types.oneOf [ types.str types.int ]);
default = { };
example = literalExample ''
{
ETESYNC_LISTEN_ADDRESS = "localhost";
ETESYNC_LISTEN_PORT = 37385;
}
'';
description = ''
Settings for etesync-dav, passed as environment variables.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
systemd.user.services.etesync-dav = {
Unit = { Description = "etesync-dav"; };
Service = {
ExecStart = "${cfg.package}/bin/etesync-dav";
Environment =
toEnvironmentCfg ({ ETESYNC_URL = cfg.serverUrl; } // cfg.settings);
};
Install = { WantedBy = [ "default.target" ]; };
};
};
}