setup calibre server

This commit is contained in:
Noah Masur 2022-10-01 21:39:36 +00:00
parent 034ff33e70
commit db0645075f
2 changed files with 42 additions and 0 deletions

View File

@ -21,5 +21,6 @@ nixpkgs.lib.nixosSystem {
../../modules/nixos
../../modules/hardware/server.nix
../../modules/services/sshd.nix
../../modules/services/calibre.nix
];
}

View File

@ -0,0 +1,41 @@
{ config, pkgs, lib, ... }:
let
libraryPath = "${config.homePath}/media/books";
in {
options = { };
config = {
services.calibre-server = {
enable = true;
libraries = [ libraryPath ];
};
services.calibre-web = {
enable = true;
openFirewall = true;
options = {
reverseProxyAuth.enable = false;
enableBookConversion = true;
};
};
home-manager.users.${config.user}.home.activation = {
# Always create library directory if it doesn't exist
calibreLibrary =
config.home-manager.users.${config.user}.lib.dag.entryAfter
[ "writeBoundary" ] ''
if [ ! -d "${libraryPath}" ]; then
$DRY_RUN_CMD mkdir --parents $VERBOSE_ARG ${libraryPath}
fi
'';
};
};
}