3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #10107 from ryantm/calibre-server

calibre-server service: init
This commit is contained in:
Domen Kožar 2015-11-01 09:19:03 +01:00
commit 581ae33e96
3 changed files with 66 additions and 0 deletions

View file

@ -234,6 +234,7 @@
#lxd = 210; # unused
kibana = 211;
xtreemfs = 212;
calibre-server = 213;
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
@ -446,6 +447,7 @@
lxd = 210; # unused
#kibana = 211;
xtreemfs = 212;
calibre-server = 213;
# When adding a gid, make sure it doesn't match an existing
# uid. Users and groups with the same name should have equal

View file

@ -189,6 +189,7 @@
./services/misc/apache-kafka.nix
#./services/misc/autofs.nix
./services/misc/canto-daemon.nix
./services/misc/calibre-server.nix
./services/misc/cpuminer-cryptonight.nix
./services/misc/cgminer.nix
./services/misc/confd.nix

View file

@ -0,0 +1,63 @@
{ 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 --with-library=${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;
};
};
}