about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorDomen Kožar <domen@dev.si>2015-11-01 09:19:03 +0100
committerDomen Kožar <domen@dev.si>2015-11-01 09:19:03 +0100
commit581ae33e969b0ac95dd9cc81e442c0642a03764f (patch)
tree22c21128dc1a5e00cd2b688f49608d9e8f2bbf6a /nixos
parent42fffee9da91db117bc382dff17890cf78944b54 (diff)
parent922bf3986b108b91908bf2d82389cdeae59332ca (diff)
downloadnixlib-581ae33e969b0ac95dd9cc81e442c0642a03764f.tar
nixlib-581ae33e969b0ac95dd9cc81e442c0642a03764f.tar.gz
nixlib-581ae33e969b0ac95dd9cc81e442c0642a03764f.tar.bz2
nixlib-581ae33e969b0ac95dd9cc81e442c0642a03764f.tar.lz
nixlib-581ae33e969b0ac95dd9cc81e442c0642a03764f.tar.xz
nixlib-581ae33e969b0ac95dd9cc81e442c0642a03764f.tar.zst
nixlib-581ae33e969b0ac95dd9cc81e442c0642a03764f.zip
Merge pull request #10107 from ryantm/calibre-server
calibre-server service: init
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/misc/ids.nix2
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/services/misc/calibre-server.nix63
3 files changed, 66 insertions, 0 deletions
diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix
index 0d2700a126f6..de9a318fdd24 100644
--- a/nixos/modules/misc/ids.nix
+++ b/nixos/modules/misc/ids.nix
@@ -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
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 77575867f873..9fcb01beaf0f 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -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
diff --git a/nixos/modules/services/misc/calibre-server.nix b/nixos/modules/services/misc/calibre-server.nix
new file mode 100644
index 000000000000..a920aa22ccdf
--- /dev/null
+++ b/nixos/modules/services/misc/calibre-server.nix
@@ -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;
+      };
+
+  };
+
+}