Merge pull request #10107 from ryantm/calibre-server

calibre-server service: init

Changed files
+66
nixos
modules
+2
nixos/modules/misc/ids.nix
···
#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!
···
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
+1
nixos/modules/module-list.nix
···
./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
+63
nixos/modules/services/misc/calibre-server.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 --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;
+
};
+
+
};
+
+
}