depot/third_party/nixpkgs/nixos/modules/services/misc/calibre-server.nix
Default email 8ac5e011d6 Project import generated by Copybara.
GitOrigin-RevId: 2c3273caa153ee8eb5786bc8141b85b859e7efd7
2020-04-24 19:36:52 -04:00

63 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.users.calibre-server = {
uid = config.ids.uids.calibre-server;
group = "calibre-server";
};
users.groups.calibre-server = {
gid = config.ids.gids.calibre-server;
};
};
}