blob: fc1d95a3e66f4a551191c3fd99708587d435a7a8 (
plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.eth.services.helix-directory-jackalope;
in {
options.eth.services.helix-directory-jackalope = {
enable = mkEnableOption "Whether to enable helix-directory-jackalope";
friendlyName = mkOption {
type = types.str;
default = "Helix (${config.networking.hostName})";
description = "Human-readable name to broadcast";
example = "My Media Server";
};
directory = mkOption {
type = types.str;
default = "";
description = "Directory to serve";
example = "/mnt/md0/media";
};
jackalopePath = mkOption {
type = types.str;
default = "";
description = "Path to Jackalope DB";
example = "/mnt/md0/media/jackalope.db";
};
};
config = mkIf cfg.enable {
assertions = [
{
assertion = cfg.directory != "";
message = "must set config.eth.services.helix-directory-jackalope.directory";
}
{
assertion = cfg.jackalopePath != "";
message = "must set config.eth.services.helix-directory-jackalope.jackalopePath";
}
];
systemd.services.helix-directory-jackalope = {
enable = true;
description = "Helix UPnP ContentDirectory server, with Jackalope";
wants = [ "network.target" ];
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
path = [ pkgs.ffmpeg ];
serviceConfig = {
DynamicUser = true;
ExecStart = "${pkgs.eth.helix}/bin/helix-directory-jackalope -friendly-name ${escapeShellArg cfg.friendlyName} -path ${escapeShellArg cfg.directory} -jackalope-path ${escapeShellArg cfg.jackalopePath}";
Restart = "always";
RestartSec = "1min";
NoNewPrivileges = true;
ProtectHome = true;
ProtectKernelTunables = true;
ProtectControlGroups = true;
ProtectKernelModules = true;
};
};
};
}
|