nixos/bazarr: init
This commit is contained in:
parent
81ccf1303b
commit
8724c96e71
|
@ -415,6 +415,7 @@
|
||||||
./services/misc/apache-kafka.nix
|
./services/misc/apache-kafka.nix
|
||||||
./services/misc/autofs.nix
|
./services/misc/autofs.nix
|
||||||
./services/misc/autorandr.nix
|
./services/misc/autorandr.nix
|
||||||
|
./services/misc/bazarr.nix
|
||||||
./services/misc/beanstalkd.nix
|
./services/misc/beanstalkd.nix
|
||||||
./services/misc/bees.nix
|
./services/misc/bees.nix
|
||||||
./services/misc/bepasty.nix
|
./services/misc/bepasty.nix
|
||||||
|
|
76
nixos/modules/services/misc/bazarr.nix
Normal file
76
nixos/modules/services/misc/bazarr.nix
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.services.bazarr;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
services.bazarr = {
|
||||||
|
enable = mkEnableOption "bazarr, a subtitle manager for Sonarr and Radarr";
|
||||||
|
|
||||||
|
openFirewall = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Open ports in the firewall for the bazarr web interface.";
|
||||||
|
};
|
||||||
|
|
||||||
|
listenPort = mkOption {
|
||||||
|
type = types.port;
|
||||||
|
default = 6767;
|
||||||
|
description = "Port on which the bazarr web interface should listen";
|
||||||
|
};
|
||||||
|
|
||||||
|
user = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "bazarr";
|
||||||
|
description = "User account under which bazarr runs.";
|
||||||
|
};
|
||||||
|
|
||||||
|
group = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "bazarr";
|
||||||
|
description = "Group under which bazarr runs.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
systemd.services.bazarr = {
|
||||||
|
description = "bazarr";
|
||||||
|
after = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
|
serviceConfig = rec {
|
||||||
|
Type = "simple";
|
||||||
|
User = cfg.user;
|
||||||
|
Group = cfg.group;
|
||||||
|
StateDirectory = "bazarr";
|
||||||
|
SyslogIdentifier = "bazarr";
|
||||||
|
ExecStart = pkgs.writeShellScript "start-bazarr" ''
|
||||||
|
${pkgs.bazarr}/bin/bazarr \
|
||||||
|
--config '/var/lib/${StateDirectory}' \
|
||||||
|
--port ${toString cfg.listenPort} \
|
||||||
|
--no-update True
|
||||||
|
'';
|
||||||
|
Restart = "on-failure";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.firewall = mkIf cfg.openFirewall {
|
||||||
|
allowedTCPPorts = [ cfg.listenPort ];
|
||||||
|
};
|
||||||
|
|
||||||
|
users.users = mkIf (cfg.user == "bazarr") {
|
||||||
|
bazarr = {
|
||||||
|
group = cfg.group;
|
||||||
|
home = "/var/lib/${config.systemd.services.bazarr.serviceConfig.StateDirectory}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
users.groups = mkIf (cfg.group == "bazarr") {
|
||||||
|
bazarr = {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -27,6 +27,7 @@ in
|
||||||
atd = handleTest ./atd.nix {};
|
atd = handleTest ./atd.nix {};
|
||||||
avahi = handleTest ./avahi.nix {};
|
avahi = handleTest ./avahi.nix {};
|
||||||
babeld = handleTest ./babeld.nix {};
|
babeld = handleTest ./babeld.nix {};
|
||||||
|
bazarr = handleTest ./bazarr.nix {};
|
||||||
bcachefs = handleTestOn ["x86_64-linux"] ./bcachefs.nix {}; # linux-4.18.2018.10.12 is unsupported on aarch64
|
bcachefs = handleTestOn ["x86_64-linux"] ./bcachefs.nix {}; # linux-4.18.2018.10.12 is unsupported on aarch64
|
||||||
beanstalkd = handleTest ./beanstalkd.nix {};
|
beanstalkd = handleTest ./beanstalkd.nix {};
|
||||||
bees = handleTest ./bees.nix {};
|
bees = handleTest ./bees.nix {};
|
||||||
|
|
26
nixos/tests/bazarr.nix
Normal file
26
nixos/tests/bazarr.nix
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
import ./make-test-python.nix ({ lib, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
port = 42069;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
name = "bazarr";
|
||||||
|
meta.maintainers = with maintainers; [ xwvvvvwx ];
|
||||||
|
|
||||||
|
nodes.machine =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.bazarr = {
|
||||||
|
enable = true;
|
||||||
|
listenPort = port;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript = ''
|
||||||
|
machine.wait_for_unit("bazarr.service")
|
||||||
|
machine.wait_for_open_port("${toString port}")
|
||||||
|
machine.succeed("curl --fail http://localhost:${toString port}/")
|
||||||
|
'';
|
||||||
|
})
|
Loading…
Reference in a new issue