1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/nixos/modules/services/misc/calibre-server.nix

64 lines
1.1 KiB
Nix
Raw Normal View History

2015-09-28 04:31:17 +01:00
{ 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;
2015-09-28 04:31:17 +01:00
};
};
};
###### implementation
config = mkIf cfg.enable {
systemd.services.calibre-server =
{
description = "Calibre Server";
2015-09-28 04:31:17 +01:00
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
User = "calibre-server";
2015-09-28 04:31:17 +01:00
Restart = "always";
ExecStart = "${pkgs.calibre}/bin/calibre-server ${cfg.libraryDir}";
2015-09-28 04:31:17 +01:00
};
};
environment.systemPackages = [ pkgs.calibre ];
users.users.calibre-server = {
2015-09-28 04:31:17 +01:00
uid = config.ids.uids.calibre-server;
group = "calibre-server";
};
2015-09-28 04:31:17 +01:00
users.groups.calibre-server = {
2015-09-28 04:31:17 +01:00
gid = config.ids.gids.calibre-server;
};
2015-09-28 04:31:17 +01:00
};
}