summaryrefslogtreecommitdiffstats
path: root/nixos
diff options
context:
space:
mode:
authorRyan Mulligan <ryan@ryantm.com>2020-10-11 05:59:28 -0700
committerGitHub <noreply@github.com>2020-10-11 05:59:28 -0700
commit8ebf265923cca2b3f3fea2016896fb70313469cb (patch)
treebedc4a1ace796b48f124665bcf21f79b881c9173 /nixos
parent03dd1b355b6c7379500becdf170850a5a1dfea5a (diff)
parent89e5a7f31f3b6f8be4041e5431c3fc3b6a085132 (diff)
Merge pull request #86404 from nuxeh/nuxeh/domoticz-init-2020.2
domoticz: init at 2020.2
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/services/misc/domoticz.nix51
2 files changed, 52 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 39f28773eab0..63df3c5779b1 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -442,6 +442,7 @@
./services/misc/dysnomia.nix
./services/misc/disnix.nix
./services/misc/docker-registry.nix
+ ./services/misc/domoticz.nix
./services/misc/errbot.nix
./services/misc/etcd.nix
./services/misc/ethminer.nix
diff --git a/nixos/modules/services/misc/domoticz.nix b/nixos/modules/services/misc/domoticz.nix
new file mode 100644
index 000000000000..b1353d484048
--- /dev/null
+++ b/nixos/modules/services/misc/domoticz.nix
@@ -0,0 +1,51 @@
+{ lib, pkgs, config, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.domoticz;
+ pkgDesc = "Domoticz home automation";
+
+in {
+
+ options = {
+
+ services.domoticz = {
+ enable = mkEnableOption pkgDesc;
+
+ bind = mkOption {
+ type = types.str;
+ default = "0.0.0.0";
+ description = "IP address to bind to.";
+ };
+
+ port = mkOption {
+ type = types.int;
+ default = 8080;
+ description = "Port to bind to for HTTP, set to 0 to disable HTTP.";
+ };
+
+ };
+
+ };
+
+ config = mkIf cfg.enable {
+
+ systemd.services."domoticz" = {
+ description = pkgDesc;
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network-online.target" ];
+ serviceConfig = {
+ DynamicUser = true;
+ StateDirectory = "domoticz";
+ Restart = "always";
+ ExecStart = ''
+ ${pkgs.domoticz}/bin/domoticz -noupdates -www ${toString cfg.port} -wwwbind ${cfg.bind} -sslwww 0 -userdata /var/lib/domoticz -approot ${pkgs.domoticz}/share/domoticz/ -pidfile /var/run/domoticz.pid
+ '';
+ };
+ };
+
+ };
+
+}