From e6af8632857a997fc407926af55f3950e9daee87 Mon Sep 17 00:00:00 2001 From: Christian Ulrich Date: Sat, 4 Apr 2020 14:40:22 +0200 Subject: [PATCH] add more packages --- default.nix | 8 +++++ pkgs/easyhid/default.nix | 20 ++++++++++++ pkgs/freetz-tools/default.nix | 61 +++++++++++++++++++++++++++++++++++ pkgs/hid/default.nix | 29 +++++++++++++++++ pkgs/hid/paths.patch | 13 ++++++++ pkgs/nim-packages/c2nim.nix | 13 ++++++++ pkgs/openphone/default.nix | 22 +++++++++++++ 7 files changed, 166 insertions(+) create mode 100644 pkgs/easyhid/default.nix create mode 100644 pkgs/freetz-tools/default.nix create mode 100644 pkgs/hid/default.nix create mode 100644 pkgs/hid/paths.patch create mode 100644 pkgs/nim-packages/c2nim.nix create mode 100644 pkgs/openphone/default.nix diff --git a/default.nix b/default.nix index 4ace7be..383ad89 100644 --- a/default.nix +++ b/default.nix @@ -3,10 +3,18 @@ self: super: { buildNimblePackage = super.callPackage ./pkgs/nim-packages/generic.nix { }; + c2nim = super.callPackage ./pkgs/nim-packages/c2nim.nix { }; + + freetz-tools = super.callPackage ./pkgs/freetz-tools/default.nix { }; + gintro = super.callPackage ./pkgs/nim-packages/gintro/default.nix { }; groupchat = super.callPackage ./pkgs/nim-packages/groupchat.nix { }; + hid = super.callPackage ./pkgs/hid/default.nix { }; + easyhid = super.callPackage ./pkgs/easyhid/default.nix { }; + openphone = super.callPackage ./pkgs/openphone/default.nix { }; + shinto-cli = super.callPackage ./pkgs/shinto-cli { }; ui = super.callPackage ./pkgs/nim-packages/ui.nix { }; diff --git a/pkgs/easyhid/default.nix b/pkgs/easyhid/default.nix new file mode 100644 index 0000000..e706e97 --- /dev/null +++ b/pkgs/easyhid/default.nix @@ -0,0 +1,20 @@ +{ stdenv, python3, hidapi }: + +with python3.pkgs; + +buildPythonPackage rec { + pname = "easyhid"; + version = "0.0.10"; + + src = fetchPypi { + inherit pname version; + sha256 = "02f6csdlv61yns017zxshx2scyvw99g490svfih2g0w80b65v84m"; + }; + + propagatedBuildInputs = [ + cffi hidapi + ]; + + doCheck = false; +} + diff --git a/pkgs/freetz-tools/default.nix b/pkgs/freetz-tools/default.nix new file mode 100644 index 0000000..2dfd3b6 --- /dev/null +++ b/pkgs/freetz-tools/default.nix @@ -0,0 +1,61 @@ +{ stdenv, pkgconfig, autoconf, automake, file, git, libtool, perl, python, + unzip, imagemagick, bash, which, glibc, gettext, bison, flex, ncurses, + readline, acl, zlib, libcap }: + +with stdenv.lib; + +let + ncursesInc = makeSearchPathOutput "dev" "include" [ ncurses ]; + zlibInc = makeSearchPathOutput "dev" "include" [ zlib ]; + readlineInc = makeSearchPathOutput "dev" "include" [ readline ]; + aclInc = makeSearchPathOutput "dev" "include" [ acl ]; + libcapInc = makeSearchPathOutput "dev" "include" [ libcap ]; +in +stdenv.mkDerivation rec { + name = "freetz-tools"; + version = "0.1"; + + src = /home/christian/Downloads/Openwrt-Router/freetz; + + patchPhase = '' + patchShebangs tools + + substituteInPlace tools/check_prerequisites \ + --replace "/sbin/ldconfig" "${glibc}/bin/ldconfig" \ + --replace "/usr/include/ /usr/local/include/" "${ncursesInc} \ + ${zlibInc} \ + ${readlineInc} \ + ${aclInc} \ + ${libcapInc}" + ''; + + buildInputs = [ + which + autoconf + automake + file + git + libtool + perl + python + unzip + imagemagick + gettext + pkgconfig + bison + flex + ncurses + readline + ]; + + buildPhase = '' + make tools + ''; + + installPhase = '' + install -D tools/unsquashfs4-avm-be $out/bin/unsquashfs4-avm-be + install -D tools/unsquashfs4-avm-le $out/bin/unsquashfs4-avm-le + install -D tools/mksquashfs4-avm-be $out/bin/mksquashfs4-avm-be + install -D tools/mksquashfs4-avm-le $out/bin/mksquashfs4-avm-le + ''; +} diff --git a/pkgs/hid/default.nix b/pkgs/hid/default.nix new file mode 100644 index 0000000..a4b0c87 --- /dev/null +++ b/pkgs/hid/default.nix @@ -0,0 +1,29 @@ +{ stdenv, python3, hidapi }: + +with python3.pkgs; + +buildPythonPackage rec { + pname = "hid"; + version = "1.0.3"; + + NIX_HIDAPI_PATH = "${hidapi}/lib/"; + + patches = [ ./paths.patch ]; + + postPatch = '' + substituteInPlace hid/__init__.py \ + --subst-var NIX_HIDAPI_PATH + ''; + + src = fetchPypi { + inherit pname version; + sha256 = "0w2ns88garrk6vjz3i91v6xzmlavyscifx4vm49303khgl2dqgvl"; + }; + + propagatedBuildInputs = [ + hidapi + ]; + + doCheck = false; +} + diff --git a/pkgs/hid/paths.patch b/pkgs/hid/paths.patch new file mode 100644 index 0000000..0b432ac --- /dev/null +++ b/pkgs/hid/paths.patch @@ -0,0 +1,13 @@ +diff --git a/hid/__init__.py b/hid/__init__.py +index 0fcd3ba..d4f3f54 100644 +--- a/hid/__init__.py ++++ b/hid/__init__.py +@@ -20,7 +20,7 @@ + + for lib in library_paths: + try: +- hidapi = ctypes.cdll.LoadLibrary(lib) ++ hidapi = ctypes.cdll.LoadLibrary(os.path.join('@NIX_HIDAPI_PATH@', lib)) + break + except OSError: + pass diff --git a/pkgs/nim-packages/c2nim.nix b/pkgs/nim-packages/c2nim.nix new file mode 100644 index 0000000..06cc611 --- /dev/null +++ b/pkgs/nim-packages/c2nim.nix @@ -0,0 +1,13 @@ +{ stdenv, buildNimblePackage, fetchfromGitHub }: + +buildNimblePackage rec { + name = "c2nim-${version}"; + version = "0.9.14"; + + src = fetchFromGitHub { + owner = "nim-lang"; + repo = "c2nim"; + rev = "774e48fbd4c9884389079ddf8427fdebefd0313d"; + sha256 = "1rrabvlr703fmsz4rm12mq81bc2njm0wb36w24vclcyz5cd26191"; + }; +} diff --git a/pkgs/openphone/default.nix b/pkgs/openphone/default.nix new file mode 100644 index 0000000..b2b1c5d --- /dev/null +++ b/pkgs/openphone/default.nix @@ -0,0 +1,22 @@ +{ stdenv, python3, hid }: + +with python3.pkgs; + +buildPythonPackage rec { + pname = "openphone"; + version = "0.1"; + src = /home/christian/projects/OpenPhone2; + + propagatedBuildInputs = [ + hid + ]; + + meta = with stdenv.lib; { + homepage = "https://ulrich.earth/code/OpenPhone"; + description = "Open source desk telephone"; + license = licenses.gpl3; + maintainers = with maintainers; [ royneary ]; + }; + + doCheck = false; +}