-
Notifications
You must be signed in to change notification settings - Fork 0
/
service.nix
47 lines (45 loc) · 1.34 KB
/
service.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.filebot;
filebot = pkgs.callPackage ./default.nix { };
in
{
options = {
services.filebot = {
enable = mkEnableOption "Enable filebot service";
user = mkOption {
type = types.str;
example = "wittano";
description = "Specific user, who will be run service";
};
configPath = mkOption {
type = with types; path;
example = ./home/wittano/setting.toml;
description = ''
Path to program configuration.
REMEMBER!
Program accept only toml-formatted files
'';
};
updateInterval = mkOption {
type = types.str;
default = "10m";
example = "1h";
description = ''
Specific time, that program updates configuration ale observed files.
Program accept time in go standard format(see https://pkg.go.dev/time#ParseDuration. This page include acceptable time format).
'';
};
};
};
config = mkIf cfg.enable {
systemd.services.filebot = {
description = "Service to automaticlly sorting files";
serviceConfig.User = mkIf (cfg.user != "root") cfg.user;
wantedBy = [ "multi-user.target" ];
path = [ filebot ];
script = "filebot -c ${cfg.configPath} -u ${cfg.updateInterval}";
};
};
}