services: add Calibre-web
This commit is contained in:
parent
51491b99a9
commit
798f75db12
52
services/calibre-web.nix
Normal file
52
services/calibre-web.nix
Normal file
|
@ -0,0 +1,52 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.my.services.calibre-web;
|
||||
domain = config.networking.domain;
|
||||
calibreDomain = "library.${domain}";
|
||||
in
|
||||
{
|
||||
options.my.services.calibre-web = with lib; {
|
||||
enable = mkEnableOption "Calibre-web server";
|
||||
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
default = 8083;
|
||||
example = 8080;
|
||||
description = "Internal port for webui";
|
||||
};
|
||||
|
||||
libraryPath = mkOption {
|
||||
type = with types; either path str;
|
||||
example = /data/media/library;
|
||||
description = "Path to the Calibre library to use";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
virtualisation.oci-containers.containers = {
|
||||
calibre-web = {
|
||||
image = "technosoft2000/calibre-web";
|
||||
volumes = [
|
||||
"${cfg.libraryPath}:/books"
|
||||
];
|
||||
ports = [
|
||||
"127.0.0.1:${toString cfg.port}:8083"
|
||||
];
|
||||
environment = {
|
||||
# NOTE: should be configurable
|
||||
SET_CONTAINER_TIMEZONE = "true";
|
||||
CONTAINER_TIMEZONE = "Europe/Paris";
|
||||
# Use 'media' group id
|
||||
PDGID = toString config.users.groups.media.gid;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."${calibreDomain}" = {
|
||||
forceSSL = true;
|
||||
useACMEHost = "${domain}";
|
||||
|
||||
locations."/".proxyPass = "http://localhost:${toString cfg.port}/";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -4,6 +4,7 @@
|
|||
imports = [
|
||||
./backup.nix
|
||||
./blog.nix
|
||||
./calibre-web.nix
|
||||
./drone.nix
|
||||
./gitea.nix
|
||||
./indexers.nix
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
mediaServices = with config.my.services; [
|
||||
calibre-web
|
||||
jellyfin
|
||||
pirate
|
||||
sabnzbd
|
||||
|
|
Loading…
Reference in a new issue