tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
nixos/services.flexget: remove `with lib;`
Felix Buehler
1 year ago
2718eb3e
16c697e1
+16
-19
1 changed file
expand all
collapse all
unified
split
nixos
modules
services
torrent
flexget.nix
+16
-19
nixos/modules/services/torrent/flexget.nix
···
4
4
pkgs,
5
5
...
6
6
}:
7
7
-
8
8
-
with lib;
9
9
-
10
7
let
11
8
cfg = config.services.flexget;
12
9
pkg = cfg.package;
13
10
ymlFile = pkgs.writeText "flexget.yml" ''
14
11
${cfg.config}
15
12
16
16
-
${optionalString cfg.systemScheduler "schedules: no"}
13
13
+
${lib.optionalString cfg.systemScheduler "schedules: no"}
17
14
'';
18
15
configFile = "${toString cfg.homeDir}/flexget.yml";
19
16
in
20
17
{
21
18
options = {
22
19
services.flexget = {
23
23
-
enable = mkEnableOption "FlexGet daemon";
20
20
+
enable = lib.mkEnableOption "FlexGet daemon";
24
21
25
25
-
package = mkPackageOption pkgs "flexget" { };
22
22
+
package = lib.mkPackageOption pkgs "flexget" { };
26
23
27
27
-
user = mkOption {
24
24
+
user = lib.mkOption {
28
25
default = "deluge";
29
26
example = "some_user";
30
30
-
type = types.str;
27
27
+
type = lib.types.str;
31
28
description = "The user under which to run flexget.";
32
29
};
33
30
34
34
-
homeDir = mkOption {
31
31
+
homeDir = lib.mkOption {
35
32
default = "/var/lib/deluge";
36
33
example = "/home/flexget";
37
37
-
type = types.path;
34
34
+
type = lib.types.path;
38
35
description = "Where files live.";
39
36
};
40
37
41
41
-
interval = mkOption {
38
38
+
interval = lib.mkOption {
42
39
default = "10m";
43
40
example = "1h";
44
44
-
type = types.str;
41
41
+
type = lib.types.str;
45
42
description = "When to perform a {command}`flexget` run. See {command}`man 7 systemd.time` for the format.";
46
43
};
47
44
48
48
-
systemScheduler = mkOption {
45
45
+
systemScheduler = lib.mkOption {
49
46
default = true;
50
47
example = false;
51
51
-
type = types.bool;
48
48
+
type = lib.types.bool;
52
49
description = "When true, execute the runs via the flexget-runner.timer. If false, you have to specify the settings yourself in the YML file.";
53
50
};
54
51
55
55
-
config = mkOption {
52
52
+
config = lib.mkOption {
56
53
default = "";
57
57
-
type = types.lines;
54
54
+
type = lib.types.lines;
58
55
description = "The YAML configuration for FlexGet.";
59
56
};
60
57
};
61
58
};
62
59
63
63
-
config = mkIf cfg.enable {
60
60
+
config = lib.mkIf cfg.enable {
64
61
65
62
environment.systemPackages = [ pkg ];
66
63
···
81
78
wantedBy = [ "multi-user.target" ];
82
79
};
83
80
84
84
-
flexget-runner = mkIf cfg.systemScheduler {
81
81
+
flexget-runner = lib.mkIf cfg.systemScheduler {
85
82
description = "FlexGet Runner";
86
83
after = [ "flexget.service" ];
87
84
wants = [ "flexget.service" ];
···
94
91
};
95
92
};
96
93
97
97
-
systemd.timers.flexget-runner = mkIf cfg.systemScheduler {
94
94
+
systemd.timers.flexget-runner = lib.mkIf cfg.systemScheduler {
98
95
description = "Run FlexGet every ${cfg.interval}";
99
96
wantedBy = [ "timers.target" ];
100
97
timerConfig = {