···
cfg = config.services.flexget;
ymlFile = pkgs.writeText "flexget.yml" ''
16
-
${optionalString cfg.systemScheduler "schedules: no"}
13
+
${lib.optionalString cfg.systemScheduler "schedules: no"}
configFile = "${toString cfg.homeDir}/flexget.yml";
23
-
enable = mkEnableOption "FlexGet daemon";
20
+
enable = lib.mkEnableOption "FlexGet daemon";
25
-
package = mkPackageOption pkgs "flexget" { };
22
+
package = lib.mkPackageOption pkgs "flexget" { };
24
+
user = lib.mkOption {
27
+
type = lib.types.str;
description = "The user under which to run flexget.";
34
-
homeDir = mkOption {
31
+
homeDir = lib.mkOption {
default = "/var/lib/deluge";
example = "/home/flexget";
34
+
type = lib.types.path;
description = "Where files live.";
41
-
interval = mkOption {
38
+
interval = lib.mkOption {
41
+
type = lib.types.str;
description = "When to perform a {command}`flexget` run. See {command}`man 7 systemd.time` for the format.";
48
-
systemScheduler = mkOption {
45
+
systemScheduler = lib.mkOption {
48
+
type = lib.types.bool;
description = "When true, execute the runs via the flexget-runner.timer. If false, you have to specify the settings yourself in the YML file.";
52
+
config = lib.mkOption {
54
+
type = lib.types.lines;
description = "The YAML configuration for FlexGet.";
63
-
config = mkIf cfg.enable {
60
+
config = lib.mkIf cfg.enable {
environment.systemPackages = [ pkg ];
···
wantedBy = [ "multi-user.target" ];
84
-
flexget-runner = mkIf cfg.systemScheduler {
81
+
flexget-runner = lib.mkIf cfg.systemScheduler {
description = "FlexGet Runner";
after = [ "flexget.service" ];
wants = [ "flexget.service" ];
···
97
-
systemd.timers.flexget-runner = mkIf cfg.systemScheduler {
94
+
systemd.timers.flexget-runner = lib.mkIf cfg.systemScheduler {
description = "Run FlexGet every ${cfg.interval}";
wantedBy = [ "timers.target" ];