Merge pull request #86404 from nuxeh/nuxeh/domoticz-init-2020.2

domoticz: init at 2020.2
This commit is contained in:
Ryan Mulligan 2020-10-11 05:59:28 -07:00 committed by GitHub
commit 8ebf265923
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 163 additions and 0 deletions

View File

@ -2395,6 +2395,12 @@
githubId = 984691;
name = "Evan Danaher";
};
edcragg = {
email = "ed.cragg@eipi.xyz";
github = "nuxeh";
githubId = 1516017;
name = "Ed Cragg";
};
edef = {
email = "edef@edef.eu";
github = "edef1c";

View File

@ -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

View File

@ -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
'';
};
};
};
}

View File

@ -0,0 +1,103 @@
{ stdenv,
fetchzip,
makeWrapper,
cmake,
python3,
openssl,
pkg-config,
mosquitto,
lua5_3,
sqlite,
jsoncpp,
zlib,
boost,
curl,
git,
libusb-compat-0_1,
cereal
}:
let
version = "2020.2";
minizip = "f5282643091dc1b33546bb8d8b3c23d78fdba231";
domoticz-src = fetchzip {
url = "https://github.com/domoticz/domoticz/archive/${version}.tar.gz";
sha256 = "1b4pkw9qp7f5r995vm4xdnpbwi9vxjyzbnk63bmy1xkvbhshm0g3";
};
minizip-src = fetchzip {
url = "https://github.com/domoticz/minizip/archive/${minizip}.tar.gz";
sha256 = "1vddrzm4pwl14bms91fs3mbqqjhcxrmpx9a68b6nfbs20xmpnsny";
};
in
stdenv.mkDerivation rec {
name = "domoticz";
inherit version;
src = domoticz-src;
postUnpack = ''
cp -r ${minizip-src}/* $sourceRoot/extern/minizip
'';
enableParallelBuilding = true;
buildInputs = [
openssl
python3
mosquitto
lua5_3
sqlite
jsoncpp
boost
zlib
curl
git
libusb-compat-0_1
cereal
];
nativeBuildInputs = [
cmake
pkg-config
makeWrapper
];
cmakeFlags = [
"-DCMAKE_BUILD_TYPE=Release"
"-DUSE_BUILTIN_MQTT=false"
"-DUSE_BUILTIN_LUA=false"
"-DUSE_BUILTIN_SQLITE=false"
"-DUSE_BUILTIN_JSONCPP=false"
"-DUSE_BUILTIN_ZLIB=false"
"-DUSE_OPENSSL_STATIC=false"
"-DUSE_STATIC_BOOST=false"
"-DUSE_BUILTIN_MINIZIP=true"
];
installPhase = ''
mkdir -p $out/share/domoticz
cp -r $src/www $out/share/domoticz/
cp -r $src/Config $out/share/domoticz
cp -r $src/scripts $out/share/domoticz
cp -r $src/plugins $out/share/domoticz
mkdir -p $out/bin
cp domoticz $out/bin
wrapProgram $out/bin/domoticz --set LD_LIBRARY_PATH ${python3}/lib;
'';
meta = with stdenv.lib; {
description = "Home automation system";
longDescription = ''
Domoticz is a home automation system that lets you monitor and configure
various devices like: lights, switches, various sensors/meters like
temperature, rain, wind, UV, electra, gas, water and much more
'';
maintainers = with maintainers; [ edcragg ];
homepage = "https://www.domoticz.com/";
license = licenses.gpl3Plus;
platforms = platforms.all;
};
}

View File

@ -3227,6 +3227,8 @@ in
inherit (darwin.apple_sdk.frameworks) CoreBluetooth ForceFeedback IOKit OpenGL;
};
domoticz = callPackage ../servers/domoticz { };
doomseeker = qt5.callPackage ../applications/misc/doomseeker { };
doom-bcc = callPackage ../games/zdoom/bcc-git.nix { };