NixOS
caution
- You cannot load a backup from another installation method after installation without losing progress. Use the Docker installation if you plan to switch drives or OS.
Installation
Declarative installation:
environment.systemPackages = [
pkgs.audiobookshelf
];
Configuration
You can configure Audiobookshelf using parameters passed to the executable.
It supports the same options you'd use with the Docker container.
The example below shows default values if none are specified:
audiobookshelf --metadata "$(pwd)/metadata" \
--config "$(pwd)/config" \
--port 8000 \
--host 0.0.0.0
If you're using a reverse proxy (you should!), listening on localhost is sufficient.
In that case, set:
--host 127.0.0.1
Start Audiobookshelf
To automatically start Audiobookshelf on boot, create a simple systemd service in your configuration.nix:
services.audiobookshelf.enable = true;
For further options, see the NixOS options page.
Optional: Configure NGINX Reverse Proxy
services.nginx = {
enable = true;
recommendedProxySettings = true;
virtualHosts."your.hostname.org" = {
forceSSL = true; # Optional, but highly recommended
locations."/" = {
proxyPass = "http://127.0.0.1:${builtins.toString config.services.audiobookshelf.port}";
proxyWebsockets = true;
extraConfig = ''
proxy_redirect http:// $scheme://;
'';
};
useACMEHost = "[attribute name from security.acme.certs]"; # Optional, but highly recommended
};
};
Check Service Status
systemctl status audiobookshelf.service