2023-10-15 00:43:59 +02:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.services.flexget;
|
|
|
|
in
|
2023-02-25 00:03:29 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
# Flexget
|
|
|
|
# Multipurpose automation tool for all of your media
|
|
|
|
|
2023-10-15 00:43:59 +02:00
|
|
|
sops.secrets.flexget.owner = "flexget";
|
|
|
|
sops.secrets.flexget.group = "flexget";
|
2023-10-15 23:42:36 +02:00
|
|
|
sops.secrets.flexget.restartUnits = [ "flexget.service" ];
|
2023-10-15 00:43:59 +02:00
|
|
|
|
2023-02-25 00:03:29 +01:00
|
|
|
services.flexget = {
|
|
|
|
enable = true;
|
|
|
|
user = "flexget"; # The user under which to run flexget.
|
|
|
|
homeDir = "/var/lib/flexget";
|
|
|
|
interval = "30m";
|
2023-10-15 00:43:59 +02:00
|
|
|
config = "";
|
2023-02-25 00:03:29 +01:00
|
|
|
};
|
|
|
|
users.groups."${config.services.flexget.user}" = lib.mkIf config.services.flexget.enable { };
|
|
|
|
users.users."${config.services.flexget.user}" = lib.mkIf config.services.flexget.enable {
|
|
|
|
isSystemUser = true;
|
|
|
|
createHome = true;
|
|
|
|
home = config.services.flexget.homeDir;
|
|
|
|
group = "${config.services.flexget.user}";
|
|
|
|
};
|
|
|
|
|
2023-10-15 00:43:59 +02:00
|
|
|
# TODO: https://github.com/NixOS/nixpkgs/pull/208199
|
|
|
|
systemd.services.flexget.serviceConfig.ExecStartPre = lib.mkForce
|
|
|
|
"${pkgs.coreutils}/bin/ln -sf /run/secrets/flexget ${toString cfg.homeDir}/flexget.yml";
|
|
|
|
systemd.services.flexget-runner.serviceConfig.ExecStartPre = lib.mkForce
|
|
|
|
"${pkgs.coreutils}/bin/ln -sf /run/secrets/flexget ${toString cfg.homeDir}/flexget.yml";
|
2023-02-25 00:03:29 +01:00
|
|
|
|
|
|
|
}
|