mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-15 02:03:01 +00:00
39a982dc3e
calibre-server changed the way you specify the library from using --with-library to just allowing the directory to be specified. See https://manual.calibre-ebook.com/generated/en/calibre-server.html for details.
64 lines
1.1 KiB
Nix
64 lines
1.1 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.services.calibre-server;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
###### interface
|
|
|
|
options = {
|
|
|
|
services.calibre-server = {
|
|
|
|
enable = mkEnableOption "calibre-server";
|
|
|
|
libraryDir = mkOption {
|
|
description = ''
|
|
The directory where the Calibre library to serve is.
|
|
'';
|
|
type = types.path;
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
###### implementation
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.services.calibre-server =
|
|
{
|
|
description = "Calibre Server";
|
|
after = [ "network.target" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
serviceConfig = {
|
|
User = "calibre-server";
|
|
Restart = "always";
|
|
ExecStart = "${pkgs.calibre}/bin/calibre-server ${cfg.libraryDir}";
|
|
};
|
|
|
|
};
|
|
|
|
environment.systemPackages = [ pkgs.calibre ];
|
|
|
|
users.extraUsers.calibre-server = {
|
|
uid = config.ids.uids.calibre-server;
|
|
group = "calibre-server";
|
|
};
|
|
|
|
users.extraGroups.calibre-server = {
|
|
gid = config.ids.gids.calibre-server;
|
|
};
|
|
|
|
};
|
|
|
|
}
|