about summary refs log tree commit diff
path: root/nixpkgs/nixos/modules/services/web-apps/documize.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/nixos/modules/services/web-apps/documize.nix')
-rw-r--r--nixpkgs/nixos/modules/services/web-apps/documize.nix67
1 files changed, 67 insertions, 0 deletions
diff --git a/nixpkgs/nixos/modules/services/web-apps/documize.nix b/nixpkgs/nixos/modules/services/web-apps/documize.nix
new file mode 100644
index 000000000000..206617b0e5ac
--- /dev/null
+++ b/nixpkgs/nixos/modules/services/web-apps/documize.nix
@@ -0,0 +1,67 @@
+{ pkgs, lib, config, ... }:
+
+with lib;
+
+let
+
+  cfg = config.services.documize;
+
+in
+
+  {
+    options.services.documize = {
+      enable = mkEnableOption "Documize Wiki";
+
+      offline = mkEnableOption "Documize offline mode";
+
+      package = mkOption {
+        default = pkgs.documize-community;
+        type = types.package;
+        description = ''
+          Which package to use for documize.
+        '';
+      };
+
+      db = mkOption {
+        type = types.str;
+        example = "host=localhost port=5432 sslmode=disable user=admin password=secret dbname=documize";
+        description = ''
+          The DB connection string to use for the database.
+        '';
+      };
+
+      dbtype = mkOption {
+        type = types.enum [ "postgresql" "percona" "mariadb" "mysql" ];
+        description = ''
+          Which database to use for storage.
+        '';
+      };
+
+      port = mkOption {
+        type = types.port;
+        example = 3000;
+        description = ''
+          Which TCP port to serve.
+        '';
+      };
+    };
+
+    config = mkIf cfg.enable {
+      systemd.services.documize-server = {
+        wantedBy = [ "multi-user.target" ];
+
+        script = ''
+          ${cfg.package}/bin/documize \
+            -db "${cfg.db}" \
+            -dbtype ${cfg.dbtype} \
+            -port ${toString cfg.port} \
+            -offline ${if cfg.offline then "1" else "0"}
+        '';
+
+        serviceConfig = {
+          Restart = "always";
+          DynamicUser = "yes";
+        };
+      };
+    };
+  }