copy nb configuration and modules
This commit is contained in:
60
utils/modules/deconz/default.nix
Normal file
60
utils/modules/deconz/default.nix
Normal file
@@ -0,0 +1,60 @@
|
||||
{ config, lib, pkgs, stdenv, ... }:
|
||||
let
|
||||
deconz-full = pkgs.callPackage ./pkg/default.nix { };
|
||||
deconz = deconz-full.deCONZ;
|
||||
in
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
deconz
|
||||
];
|
||||
|
||||
|
||||
users.users."deconz" = {
|
||||
createHome = true;
|
||||
isSystemUser = true;
|
||||
group = "dialout";
|
||||
home = "/home/deconz";
|
||||
};
|
||||
|
||||
systemd.services.deconz = {
|
||||
enable = true;
|
||||
description = "deconz";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
stopIfChanged = false;
|
||||
serviceConfig = {
|
||||
ExecStart = "${deconz}/bin/deCONZ -platform minimal --http-port=8080 --ws-port=8081 --http-listen=127.0.0.1 --dev=/dev/ttyACM0";
|
||||
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
||||
Restart = "always";
|
||||
RestartSec = "10s";
|
||||
# StartLimitInterval = "1min";
|
||||
# StateDirectory = "/var/lib/deconz";
|
||||
User = "deconz";
|
||||
# DeviceAllow = "char-ttyUSB rwm";
|
||||
# DeviceAllow = "char-usb_device rwm";
|
||||
# AmbientCapabilities="CAP_NET_BIND_SERVICE CAP_KILL CAP_SYS_BOOT CAP_SYS_TIME";
|
||||
};
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."deconz.cloonar.com" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
acmeRoot = null;
|
||||
extraConfig = ''
|
||||
proxy_buffering off;
|
||||
'';
|
||||
locations."/".extraConfig = ''
|
||||
set $p 8080;
|
||||
if ($http_upgrade = "websocket") {
|
||||
set $p 8081;
|
||||
}
|
||||
proxy_pass http://127.0.0.1:$p;
|
||||
proxy_set_header Host $host;
|
||||
proxy_redirect http:// https://;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
'';
|
||||
};
|
||||
}
|
||||
50
utils/modules/deconz/pkg/default.nix
Normal file
50
utils/modules/deconz/pkg/default.nix
Normal file
@@ -0,0 +1,50 @@
|
||||
{ config, pkgs, stdenv, buildFHSUserEnv, fetchurl, dpkg, qt5, sqlite, hicolor-icon-theme, libcap, libpng, libxcrypt-legacy, ... }:
|
||||
#ith import <nixpkgs> {};
|
||||
let
|
||||
version = "2.21.02";
|
||||
name = "deconz-${version}";
|
||||
in
|
||||
rec {
|
||||
deCONZ-deb = stdenv.mkDerivation {
|
||||
#builder = ./builder.sh;
|
||||
inherit name;
|
||||
dpkg = dpkg;
|
||||
src = fetchurl {
|
||||
url = "https://deconz.dresden-elektronik.de/ubuntu/stable/${name}-qt5.deb";
|
||||
sha256 = "2d5ab8af471ffa82fb0fd0c8a2f0bb09e7c0bd9a03ef887abe49c616c63042f0";
|
||||
};
|
||||
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
dontStrip = true;
|
||||
|
||||
buildInputs = [ dpkg sqlite hicolor-icon-theme libcap libpng qt5.qtbase qt5.qtserialport qt5.qtwebsockets qt5.wrapQtAppsHook libxcrypt-legacy ]; # qt5.qtserialport qt5.qtwebsockets ];
|
||||
|
||||
unpackPhase = "dpkg-deb -x $src .";
|
||||
installPhase = ''
|
||||
cp -r usr/* .
|
||||
cp -r ${libxcrypt-legacy}/lib/* share/deCONZ/plugins/
|
||||
cp -r share/deCONZ/plugins/* lib/
|
||||
cp -r . $out
|
||||
'';
|
||||
|
||||
};
|
||||
deCONZ = buildFHSUserEnv {
|
||||
name = "deCONZ";
|
||||
targetPkgs = pkgs: [
|
||||
deCONZ-deb
|
||||
];
|
||||
multiPkgs = pkgs: [
|
||||
dpkg
|
||||
qt5.qtbase
|
||||
qt5.qtserialport
|
||||
qt5.qtwebsockets
|
||||
qt5.wrapQtAppsHook
|
||||
sqlite
|
||||
hicolor-icon-theme
|
||||
libcap
|
||||
libpng
|
||||
];
|
||||
runScript = "deCONZ";
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user