···
1
+
{ config, lib, pkgs, ... }:
6
+
cfg = config.services.botamusique;
8
+
format = pkgs.formats.ini {};
9
+
configFile = format.generate "botamusique.ini" cfg.settings;
12
+
meta.maintainers = with lib.maintainers; [ hexa ];
14
+
options.services.botamusique = {
15
+
enable = mkEnableOption "botamusique, a bot to play audio streams on mumble";
17
+
package = mkOption {
18
+
type = types.package;
19
+
default = pkgs.botamusique;
20
+
description = "The botamusique package to use.";
23
+
settings = mkOption {
24
+
type = with types; submodule {
25
+
freeformType = format.type;
27
+
server.host = mkOption {
29
+
default = "localhost";
30
+
example = "mumble.example.com";
31
+
description = "Hostname of the mumble server to connect to.";
34
+
server.port = mkOption {
37
+
description = "Port of the mumble server to connect to.";
40
+
bot.username = mkOption {
42
+
default = "botamusique";
43
+
description = "Name the bot should appear with.";
46
+
bot.comment = mkOption {
48
+
default = "Hi, I'm here to play radio, local music or youtube/soundcloud music. Have fun!";
49
+
description = "Comment displayed for the bot.";
55
+
Your <filename>configuration.ini</filename> as a Nix attribute set. Look up
56
+
possible options in the <link xlink:href="https://github.com/azlux/botamusique/blob/master/configuration.example.ini">configuration.example.ini</link>.
61
+
config = mkIf cfg.enable {
62
+
systemd.services.botamusique = {
63
+
after = [ "network.target" ];
64
+
wantedBy = [ "multi-user.target" ];
66
+
unitConfig.Documentation = "https://github.com/azlux/botamusique/wiki";
68
+
environment.HOME = "/var/lib/botamusique";
71
+
ExecStart = "${cfg.package}/bin/botamusique --config ${configFile}";
72
+
Restart = "always"; # the bot exits when the server connection is lost
75
+
CapabilityBoundingSet = [ "" ];
81
+
LockPersonality = true;
82
+
MemoryDenyWriteExecute = true;
84
+
PrivateDevices = true;
85
+
PrivateUsers = true;
87
+
ProtectClock = true;
88
+
ProtectControlGroups = true;
90
+
ProtectHostname = true;
91
+
ProtectKernelLogs = true;
92
+
ProtectKernelModules = true;
93
+
ProtectKernelTunables = true;
94
+
ProtectProc = "invisible";
95
+
ProtectSystem = "strict";
96
+
RestrictNamespaces = true;
97
+
RestrictRealtime = true;
98
+
RestrictAddressFamilies = [
102
+
StateDirectory = "botamusique";
103
+
SystemCallArchitectures = "native";
104
+
SystemCallFilter = [
110
+
WorkingDirectory = "/var/lib/botamusique";