Files
nixpkgs/pkgs/by-name/de/deconz/package.nix
2026-02-17 00:40:39 +00:00

97 lines
2.2 KiB
Nix

{
stdenv,
lib,
fetchurl,
qt5,
dpkg,
autoPatchelfHook,
openssl,
libredirect,
makeWrapper,
gzip,
gnutar,
nixosTests,
}:
stdenv.mkDerivation rec {
pname = "deconz";
version = "2.32.5";
src = fetchurl {
url = "https://deconz.dresden-elektronik.de/ubuntu/beta/deconz-${version}-qt5.deb";
sha256 = "sha256-57HS7x76qLBfBGuYu8gEXqVTLldLz/ixg4fE6+LnIzI=";
};
nativeBuildInputs = [
dpkg
autoPatchelfHook
makeWrapper
qt5.wrapQtAppsHook
];
buildInputs = [
qt5.qtserialport
qt5.qtwebsockets
openssl
];
unpackPhase = ''
runHook preUnpack
dpkg -x $src ./deconz-src
runHook postUnpack
'';
installPhase = ''
runHook preInstall
mkdir -p "$out"
cp -r deconz-src/* "$out"
# Flatten /usr and manually merge lib/ and usr/lib/, since mv refuses to.
mv "$out/lib" "$out/orig_lib"
mv "$out/usr/"* "$out/"
mkdir -p "$out/lib/systemd/system/"
mv "$out/orig_lib/systemd/system/"* "$out/lib/systemd/system/"
rmdir "$out/orig_lib/systemd/system"
rmdir "$out/orig_lib/systemd"
rmdir "$out/orig_lib"
rmdir "$out/usr"
for f in "$out/lib/systemd/system/"*.service \
"$out/share/applications/"*.desktop; do
substituteInPlace "$f" \
--replace "/usr/" "$out/"
done
for p in "$out/bin/deCONZ" "$out/bin/GCFFlasher_internal.bin"; do
wrapProgram "$p" \
--set LD_PRELOAD "${libredirect}/lib/libredirect.so" \
--set NIX_REDIRECTS "/usr/share=$out/share:/usr/bin=$out/bin" \
--prefix PATH : "${
lib.makeBinPath [
gzip
gnutar
]
}"
done
runHook postInstall
'';
passthru = {
tests = { inherit (nixosTests) deconz; };
};
meta = {
description = "Manage Zigbee network with ConBee, ConBee II or RaspBee hardware";
homepage = "https://www.dresden-elektronik.com/wireless/software/deconz.html";
license = lib.licenses.unfree;
platforms = [ "x86_64-linux" ];
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
maintainers = with lib.maintainers; [ bjornfor ];
mainProgram = "deCONZ";
};
}