From e0fc3b5fa1702d37f38766073fa80f1789d11e4f Mon Sep 17 00:00:00 2001 From: Elis Hirwing Date: Sat, 7 Apr 2018 20:11:56 +0200 Subject: [PATCH 1/4] openzwave: Init at 2018-04-04 --- .../libraries/openzwave/default.nix | 56 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 58 insertions(+) create mode 100644 pkgs/development/libraries/openzwave/default.nix diff --git a/pkgs/development/libraries/openzwave/default.nix b/pkgs/development/libraries/openzwave/default.nix new file mode 100644 index 00000000000..63c51996b22 --- /dev/null +++ b/pkgs/development/libraries/openzwave/default.nix @@ -0,0 +1,56 @@ +{ stdenv, fetchFromGitHub +, doxygen, fontconfig, graphviz-nox, libxml2, pkgconfig, which +, systemd }: + +let + version = "2018-04-04"; + +in stdenv.mkDerivation rec { + name = "openzwave-${version}"; + + src = fetchFromGitHub { + owner = "OpenZWave"; + repo = "open-zwave"; + rev = "ab5fe966fee882bb9e8d78a91db892a60a1863d9"; + sha256 = "0yby8ygzjn5zp5vhysxaadbzysqanwd2zakz379299qs454pr2h9"; + }; + + nativeBuildInputs = [ doxygen fontconfig graphviz-nox libxml2 pkgconfig which ]; + + buildInputs = [ systemd ]; + + enableParallelBuilding = true; + + installPhase = '' + runHook preInstall + + DESTDIR=$out PREFIX= pkgconfigdir=lib/pkgconfig make install $installFlags + + runHook postInstall + ''; + + FONTCONFIG_FILE="${fontconfig.out}/etc/fonts/fonts.conf"; + FONTCONFIG_PATH="${fontconfig.out}/etc/fonts/"; + + postPatch = '' + substituteInPlace cpp/src/Options.cpp \ + --replace /etc/openzwave $out/etc/openzwave + ''; + + fixupPhase = '' + substituteInPlace $out/lib/pkgconfig/libopenzwave.pc \ + --replace prefix= prefix=$out \ + --replace dir= dir=$out + + substituteInPlace $out/bin/ozw_config \ + --replace pcfile=${pkgconfig} pcfile=$out + ''; + + meta = with stdenv.lib; { + description = "C++ library to control Z-Wave Networks via a USB Z-Wave Controller"; + homepage = http://www.openzwave.net/; + license = licenses.gpl3; + maintainers = with maintainers; [ etu ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1480b906403..3195410c3c1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -20532,6 +20532,8 @@ with pkgs; moltengamepad = callPackage ../misc/drivers/moltengamepad { }; + openzwave = callPackage ../development/libraries/openzwave { }; + mongoc = callPackage ../development/libraries/mongoc { }; mupen64plus = callPackage ../misc/emulators/mupen64plus { }; From f1f3ece81edab4c652dc38195b3941ca65cf1503 Mon Sep 17 00:00:00 2001 From: Elis Hirwing Date: Sat, 7 Apr 2018 23:33:10 +0200 Subject: [PATCH 2/4] python36Packages.python_openzwave: init at 0.4.4 --- .../python_openzwave/default.nix | 40 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 42 insertions(+) create mode 100644 pkgs/development/python-modules/python_openzwave/default.nix diff --git a/pkgs/development/python-modules/python_openzwave/default.nix b/pkgs/development/python-modules/python_openzwave/default.nix new file mode 100644 index 00000000000..d5cf709104f --- /dev/null +++ b/pkgs/development/python-modules/python_openzwave/default.nix @@ -0,0 +1,40 @@ +{ stdenv, buildPythonPackage, fetchPypi, isPy3k +, pkgconfig +, systemd, libyaml, openzwave, cython +, six, pydispatcher, urwid }: + +buildPythonPackage rec { + pname = "python_openzwave"; + version = "0.4.4"; + + disabled = !isPy3k; + + src = fetchPypi { + inherit pname version; + sha256 = "17wdgwg212agj1gxb2kih4cvhjb5bprir4x446s8qwx0mz03azk2"; + extension = "zip"; + }; + + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ systemd libyaml openzwave cython ]; + propagatedBuildInputs = [ six urwid pydispatcher ]; + + # primary location for the .xml files is in /etc/openzwave so we override the + # /usr/local/etc lookup instead as that allows us to dump new .xml files into + # /etc/openzwave if needed + postPatch = '' + substituteInPlace src-lib/libopenzwave/libopenzwave.pyx \ + --replace /usr/local/etc/openzwave ${openzwave}/etc/openzwave + ''; + + # no tests available + doCheck = false; + + meta = with stdenv.lib; { + description = "Python wrapper for the OpenZWave C++ library"; + homepage = https://github.com/OpenZWave/python-openzwave; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ etu ]; + inherit (openzwave.meta) platforms; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index c5211a1a314..2c941134e94 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -8935,6 +8935,8 @@ in { python-oauth2 = callPackage ../development/python-modules/python-oauth2 { }; + python_openzwave = callPackage ../development/python-modules/python_openzwave { }; + python-Levenshtein = buildPythonPackage rec { name = "python-Levenshtein-${version}"; version = "0.12.0"; From 51d1aad9f3a10ccbabdb013f3c9f067bca4f23d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Sun, 8 Apr 2018 11:59:07 +0200 Subject: [PATCH 3/4] home-assistant: treat "-" and "_" equally in parse-requirements.py --- pkgs/servers/home-assistant/component-packages.nix | 8 ++++---- pkgs/servers/home-assistant/parse-requirements.py | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pkgs/servers/home-assistant/component-packages.nix b/pkgs/servers/home-assistant/component-packages.nix index 5372b577e33..852b210ba15 100644 --- a/pkgs/servers/home-assistant/component-packages.nix +++ b/pkgs/servers/home-assistant/component-packages.nix @@ -112,8 +112,8 @@ "hue" = ps: with ps; [ ]; "ifttt" = ps: with ps; [ ]; "ihc" = ps: with ps; [ ]; - "image_processing.dlib_face_detect" = ps: with ps; [ ]; - "image_processing.dlib_face_identify" = ps: with ps; [ ]; + "image_processing.dlib_face_detect" = ps: with ps; [ face_recognition ]; + "image_processing.dlib_face_identify" = ps: with ps; [ face_recognition ]; "image_processing.opencv" = ps: with ps; [ numpy ]; "influxdb" = ps: with ps; [ influxdb ]; "insteon_local" = ps: with ps; [ ]; @@ -172,7 +172,7 @@ "media_player.dunehd" = ps: with ps; [ ]; "media_player.emby" = ps: with ps; [ ]; "media_player.frontier_silicon" = ps: with ps; [ ]; - "media_player.gpmdp" = ps: with ps; [ ]; + "media_player.gpmdp" = ps: with ps; [ websocket_client ]; "media_player.gstreamer" = ps: with ps; [ ]; "media_player.kodi" = ps: with ps; [ jsonrpc-async jsonrpc-websocket ]; "media_player.lg_netcast" = ps: with ps; [ ]; @@ -447,6 +447,6 @@ "zeroconf" = ps: with ps; [ zeroconf ]; "zha" = ps: with ps; [ ]; "zigbee" = ps: with ps; [ ]; - "zwave" = ps: with ps; [ pydispatcher ]; + "zwave" = ps: with ps; [ pydispatcher python_openzwave ]; }; } diff --git a/pkgs/servers/home-assistant/parse-requirements.py b/pkgs/servers/home-assistant/parse-requirements.py index 87ef65482ab..46e7acee178 100755 --- a/pkgs/servers/home-assistant/parse-requirements.py +++ b/pkgs/servers/home-assistant/parse-requirements.py @@ -1,5 +1,5 @@ #! /usr/bin/env nix-shell -#! nix-shell -i python3 -p "python3.withPackages (ps: with ps; [ setuptools ])" +#! nix-shell -i python3 -p "python3.withPackages (ps: with ps; [ ])" # # This script downloads https://github.com/home-assistant/home-assistant/blob/master/requirements_all.txt. # This file contains lines of the form @@ -20,7 +20,6 @@ import os import sys import json import re -from pkg_resources import Requirement, RequirementParseError GENERAL_PREFIX = '# homeassistant.' COMPONENT_PREFIX = GENERAL_PREFIX + 'components.' @@ -64,9 +63,11 @@ def name_to_attr_path(req): names = [req] # E.g. python-mpd2 is actually called python3.6-mpd2 # instead of python-3.6-python-mpd2 inside Nixpkgs - if req.startswith('python-'): + if req.startswith('python-') or req.startswith('python_'): names.append(req[len('python-'):]) for name in names: + # treat "-" and "_" equally + name = re.sub('[-_]', '[-_]', name) pattern = re.compile('^python\\d\\.\\d-{}-\\d'.format(name), re.I) for attr_path, package in packages.items(): if pattern.match(package['name']): @@ -86,7 +87,7 @@ for component, reqs in OrderedDict(sorted(requirements.items())).items(): attr_paths = [] for req in reqs: try: - name = Requirement.parse(req).project_name + name = req.split('==')[0] attr_path = name_to_attr_path(name) if attr_path is not None: # Add attribute path without "python3Packages." prefix From a292149c8beaea603051febd20428860ad73f0ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Sun, 8 Apr 2018 13:21:52 +0200 Subject: [PATCH 4/4] home-assistant: treat extraComponents with multiple requirements correctly --- pkgs/servers/home-assistant/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/servers/home-assistant/default.nix b/pkgs/servers/home-assistant/default.nix index 75f8b309a40..944edc35176 100644 --- a/pkgs/servers/home-assistant/default.nix +++ b/pkgs/servers/home-assistant/default.nix @@ -45,7 +45,7 @@ let getPackages = component: builtins.getAttr component componentPackages.components; - componentBuildInputs = map (component: getPackages component py.pkgs) extraComponents; + componentBuildInputs = lib.concatMap (component: getPackages component py.pkgs) extraComponents; # Ensure that we are using a consistent package set extraBuildInputs = extraPackages py.pkgs;