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 = mkPackageOption pkgs "botamusique" { };
20 type = with types; submodule {
21 freeformType = format.type;
23 server.host = mkOption {
25 default = "localhost";
26 example = "mumble.example.com";
27 description = "Hostname of the mumble server to connect to.";
30 server.port = mkOption {
33 description = "Port of the mumble server to connect to.";
36 bot.username = mkOption {
38 default = "botamusique";
39 description = "Name the bot should appear with.";
42 bot.comment = mkOption {
44 default = "Hi, I'm here to play radio, local music or youtube/soundcloud music. Have fun!";
45 description = "Comment displayed for the bot.";
51 Your {file}`configuration.ini` as a Nix attribute set. Look up
52 possible options in the [configuration.example.ini](https://github.com/azlux/botamusique/blob/master/configuration.example.ini).
57 config = mkIf cfg.enable {
58 systemd.services.botamusique = {
59 after = [ "network.target" ];
60 wantedBy = [ "multi-user.target" ];
62 unitConfig.Documentation = "https://github.com/azlux/botamusique/wiki";
64 environment.HOME = "/var/lib/botamusique";
67 ExecStart = "${cfg.package}/bin/botamusique --config ${configFile}";
68 Restart = "always"; # the bot exits when the server connection is lost
71 CapabilityBoundingSet = [ "" ];
77 LockPersonality = true;
78 MemoryDenyWriteExecute = true;
80 PrivateDevices = true;
84 ProtectControlGroups = true;
86 ProtectHostname = true;
87 ProtectKernelLogs = true;
88 ProtectKernelModules = true;
89 ProtectKernelTunables = true;
90 ProtectProc = "invisible";
91 ProtectSystem = "strict";
92 RestrictNamespaces = true;
93 RestrictRealtime = true;
94 RestrictAddressFamilies = [
98 StateDirectory = "botamusique";
99 SystemCallArchitectures = "native";
101 "@system-service @resources"
105 WorkingDirectory = "/var/lib/botamusique";