config/profiles/http/services/flexget.nix

36 lines
1.1 KiB
Nix

{ config, pkgs, lib, ... }:
let
cfg = config.services.flexget;
in
{
# Flexget
# Multipurpose automation tool for all of your media
sops.secrets.flexget.owner = "flexget";
sops.secrets.flexget.group = "flexget";
sops.secrets.flexget.restartUnits = [ "flexget.service" ];
services.flexget = {
enable = true;
user = "flexget"; # The user under which to run flexget.
homeDir = "/var/lib/flexget";
interval = "30m";
config = "";
};
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}";
};
# 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";
}