mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-09-11 07:15:54 +03:00
audiobookshelf: init module
This commit is contained in:
parent
8d8e78c9c2
commit
86dbce6d07
@ -87,6 +87,8 @@
|
|||||||
|
|
||||||
- [tuxedo-rs](https://github.com/AaronErhardt/tuxedo-rs), Rust utilities for interacting with hardware from TUXEDO Computers.
|
- [tuxedo-rs](https://github.com/AaronErhardt/tuxedo-rs), Rust utilities for interacting with hardware from TUXEDO Computers.
|
||||||
|
|
||||||
|
- [audiobookshelf](https://github.com/advplyr/audiobookshelf/), a self-hosted audiobook and podcast server. Available as [services.audiobookshelf](#opt-services.audiobookshelf.enable).
|
||||||
|
|
||||||
## Backward Incompatibilities {#sec-release-23.11-incompatibilities}
|
## Backward Incompatibilities {#sec-release-23.11-incompatibilities}
|
||||||
|
|
||||||
- The `boot.loader.raspberryPi` options have been marked deprecated, with intent for removal for NixOS 24.11. They had a limited use-case, and do not work like people expect. They required either very old installs ([before mid-2019](https://github.com/NixOS/nixpkgs/pull/62462)) or customized builds out of scope of the standard and generic AArch64 support. That option set never supported the Raspberry Pi 4 family of devices.
|
- The `boot.loader.raspberryPi` options have been marked deprecated, with intent for removal for NixOS 24.11. They had a limited use-case, and do not work like people expect. They required either very old installs ([before mid-2019](https://github.com/NixOS/nixpkgs/pull/62462)) or customized builds out of scope of the standard and generic AArch64 support. That option set never supported the Raspberry Pi 4 family of devices.
|
||||||
|
@ -1211,6 +1211,7 @@
|
|||||||
./services/web-apps/atlassian/confluence.nix
|
./services/web-apps/atlassian/confluence.nix
|
||||||
./services/web-apps/atlassian/crowd.nix
|
./services/web-apps/atlassian/crowd.nix
|
||||||
./services/web-apps/atlassian/jira.nix
|
./services/web-apps/atlassian/jira.nix
|
||||||
|
./services/web-apps/audiobookshelf.nix
|
||||||
./services/web-apps/bookstack.nix
|
./services/web-apps/bookstack.nix
|
||||||
./services/web-apps/calibre-web.nix
|
./services/web-apps/calibre-web.nix
|
||||||
./services/web-apps/coder.nix
|
./services/web-apps/coder.nix
|
||||||
|
90
nixos/modules/services/web-apps/audiobookshelf.nix
Normal file
90
nixos/modules/services/web-apps/audiobookshelf.nix
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.services.audiobookshelf;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
services.audiobookshelf = {
|
||||||
|
enable = mkEnableOption "Audiobookshelf, self-hosted audiobook and podcast server.";
|
||||||
|
|
||||||
|
package = mkPackageOption pkgs "audiobookshelf" { };
|
||||||
|
|
||||||
|
dataDir = mkOption {
|
||||||
|
description = "Path to Audiobookshelf config and metadata inside of /var/lib.";
|
||||||
|
default = "audiobookshelf";
|
||||||
|
type = types.str;
|
||||||
|
};
|
||||||
|
|
||||||
|
host = mkOption {
|
||||||
|
description = "The host Audiobookshelf binds to.";
|
||||||
|
default = "127.0.0.1";
|
||||||
|
example = "0.0.0.0";
|
||||||
|
type = types.str;
|
||||||
|
};
|
||||||
|
|
||||||
|
port = mkOption {
|
||||||
|
description = "The TCP port Audiobookshelf will listen on.";
|
||||||
|
default = 8000;
|
||||||
|
type = types.port;
|
||||||
|
};
|
||||||
|
|
||||||
|
user = mkOption {
|
||||||
|
description = "User account under which Audiobookshelf runs.";
|
||||||
|
default = "audiobookshelf";
|
||||||
|
type = types.str;
|
||||||
|
};
|
||||||
|
|
||||||
|
group = mkOption {
|
||||||
|
description = "Group under which Audiobookshelf runs.";
|
||||||
|
default = "audiobookshelf";
|
||||||
|
type = types.str;
|
||||||
|
};
|
||||||
|
|
||||||
|
openFirewall = mkOption {
|
||||||
|
description = "Open ports in the firewall for the Audiobookshelf web interface.";
|
||||||
|
default = false;
|
||||||
|
type = types.bool;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
systemd.services.audiobookshelf = {
|
||||||
|
description = "Audiobookshelf is a self-hosted audiobook and podcast server";
|
||||||
|
|
||||||
|
after = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "simple";
|
||||||
|
User = cfg.user;
|
||||||
|
Group = cfg.group;
|
||||||
|
StateDirectory = cfg.dataDir;
|
||||||
|
WorkingDirectory = "/var/lib/${cfg.dataDir}";
|
||||||
|
ExecStart = "${cfg.package}/bin/audiobookshelf --host ${cfg.host} --port ${toString cfg.port}";
|
||||||
|
Restart = "on-failure";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
users.users = mkIf (cfg.user == "audiobookshelf") {
|
||||||
|
audiobookshelf = {
|
||||||
|
isSystemUser = true;
|
||||||
|
group = cfg.group;
|
||||||
|
home = "/var/lib/${cfg.dataDir}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
users.groups = mkIf (cfg.group == "audiobookshelf") {
|
||||||
|
audiobookshelf = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.firewall = mkIf cfg.openFirewall {
|
||||||
|
allowedTCPPorts = [ cfg.port ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
meta.maintainers = with maintainers; [ wietsedv ];
|
||||||
|
}
|
@ -119,6 +119,7 @@ in {
|
|||||||
atd = handleTest ./atd.nix {};
|
atd = handleTest ./atd.nix {};
|
||||||
atop = handleTest ./atop.nix {};
|
atop = handleTest ./atop.nix {};
|
||||||
atuin = handleTest ./atuin.nix {};
|
atuin = handleTest ./atuin.nix {};
|
||||||
|
audiobookshelf = handleTest ./audiobookshelf.nix {};
|
||||||
auth-mysql = handleTest ./auth-mysql.nix {};
|
auth-mysql = handleTest ./auth-mysql.nix {};
|
||||||
authelia = handleTest ./authelia.nix {};
|
authelia = handleTest ./authelia.nix {};
|
||||||
avahi = handleTest ./avahi.nix {};
|
avahi = handleTest ./avahi.nix {};
|
||||||
|
23
nixos/tests/audiobookshelf.nix
Normal file
23
nixos/tests/audiobookshelf.nix
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import ./make-test-python.nix ({ lib, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
{
|
||||||
|
name = "audiobookshelf";
|
||||||
|
meta.maintainers = with maintainers; [ wietsedv ];
|
||||||
|
|
||||||
|
nodes.machine =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.audiobookshelf = {
|
||||||
|
enable = true;
|
||||||
|
port = 1234;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript = ''
|
||||||
|
machine.wait_for_unit("audiobookshelf.service")
|
||||||
|
machine.wait_for_open_port(1234)
|
||||||
|
machine.succeed("curl --fail http://localhost:1234/")
|
||||||
|
'';
|
||||||
|
})
|
Loading…
Reference in New Issue
Block a user