mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-02-07 12:19:07 +00:00
services/matcha: init module
This commit is contained in:
parent
049913a9ea
commit
be9295b6aa
@ -12,6 +12,7 @@ let
|
|||||||
./services/bleachbit.nix
|
./services/bleachbit.nix
|
||||||
./services/distant.nix
|
./services/distant.nix
|
||||||
./services/gallery-dl.nix
|
./services/gallery-dl.nix
|
||||||
|
./services/matcha.nix
|
||||||
./services/plover.nix
|
./services/plover.nix
|
||||||
./services/yt-dlp.nix
|
./services/yt-dlp.nix
|
||||||
];
|
];
|
||||||
|
85
modules/home-manager/services/matcha.nix
Normal file
85
modules/home-manager/services/matcha.nix
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
{ config, options, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.services.matcha;
|
||||||
|
|
||||||
|
settingsFormat = pkgs.formats.yaml { };
|
||||||
|
settingsFile = settingsFormat.generate "matcha-config" cfg.settings;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.services.matcha = {
|
||||||
|
enable = lib.mkEnableOption "Matcha periodic feed digest generator";
|
||||||
|
|
||||||
|
package = lib.mkOption {
|
||||||
|
description = ''
|
||||||
|
The package containing the {command}`matcha` executable.
|
||||||
|
'';
|
||||||
|
type = lib.types.package;
|
||||||
|
default = pkgs.matcha;
|
||||||
|
defaultText = "pkgs.matcha";
|
||||||
|
};
|
||||||
|
|
||||||
|
settings = lib.mkOption {
|
||||||
|
description = ''
|
||||||
|
The configuration to be used with the Matcha service.
|
||||||
|
'';
|
||||||
|
type = settingsFormat.type;
|
||||||
|
default = { };
|
||||||
|
defaultText = "{}";
|
||||||
|
example = lib.literalExpression ''
|
||||||
|
{
|
||||||
|
markdown_dir_path = "''${config.xdg.userDirs.documents}/Matcha";
|
||||||
|
feeds = [
|
||||||
|
"http://hnrss.org/best 10"
|
||||||
|
"https://waitbutwhy.com/feed"
|
||||||
|
"http://tonsky.me/blog/atom.xml"
|
||||||
|
"http://www.joelonsoftware.com/rss.xml"
|
||||||
|
"https://www.youtube.com/feeds/videos.xml?channel_id=UCHnyfMqiRRG1u-2MsSQLbXA"
|
||||||
|
];
|
||||||
|
opml_file_path = "''${config.xdg.userDirs.documents}/feeds.opml";
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
startAt = lib.mkOption {
|
||||||
|
description = ''
|
||||||
|
How often the service generates the digest.
|
||||||
|
|
||||||
|
The value is used to `Calendar.OnCalendar` systemd timer option. For
|
||||||
|
more details about the value format, see {manpage}`systemd.time(7)`.
|
||||||
|
'';
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "daily";
|
||||||
|
example = "weekly";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
systemd.user.services.matcha = {
|
||||||
|
Unit = {
|
||||||
|
Description = "Matcha periodic feed digest generator";
|
||||||
|
Documentation = [ "https://github.com/piqoni/matcha" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
Install.WantedBy = [ "default.target" ];
|
||||||
|
|
||||||
|
Service = {
|
||||||
|
ExecStart = "${cfg.package}/bin/matcha -c ${settingsFile}";
|
||||||
|
Restart = "on-failure";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.user.timers.matcha = {
|
||||||
|
Unit = {
|
||||||
|
Description = "Matcha periodic feed digest generator";
|
||||||
|
Documentation = [ "https://github.com/piqoni/matcha" ];
|
||||||
|
After = [ "network.target" ];
|
||||||
|
};
|
||||||
|
Install.WantedBy = [ "timers.target" ];
|
||||||
|
Timer = {
|
||||||
|
Persistent = true;
|
||||||
|
OnCalendar = cfg.startAt;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user