etesync-dav: add module
This commit is contained in:
parent
f298705ae4
commit
30355f8ee6
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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; })
|
||||
|
|
62
modules/services/etesync-dav.nix
Normal file
62
modules/services/etesync-dav.nix
Normal 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" ]; };
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue