summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2022-03-02 15:02:59 +0100
committerGitHub <noreply@github.com>2022-03-02 15:02:59 +0100
commit64d1e023d232c30bcb4da8bbd843ed1df97ac0e5 (patch)
treec85bef6672b9878b9aef1555d5c4c7fa0fb09992 /pkgs
parentc02944e17d0d8ea91c9dc8878dc93697f7098838 (diff)
parent20513dccbc16c2c0517da2c4a3fc6e61e88f9560 (diff)
Merge pull request #147127 from WolfangAukang/opendrop
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/python-modules/fleep/0001-Fixing-paths-on-tests.patch48
-rw-r--r--pkgs/development/python-modules/fleep/default.nix36
-rw-r--r--pkgs/tools/networking/opendrop/default.nix41
-rw-r--r--pkgs/tools/networking/owl/default.nix25
-rw-r--r--pkgs/top-level/all-packages.nix4
-rw-r--r--pkgs/top-level/python-packages.nix2
6 files changed, 156 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/fleep/0001-Fixing-paths-on-tests.patch b/pkgs/development/python-modules/fleep/0001-Fixing-paths-on-tests.patch
new file mode 100644
index 0000000000000..234bf0cb379b5
--- /dev/null
+++ b/pkgs/development/python-modules/fleep/0001-Fixing-paths-on-tests.patch
@@ -0,0 +1,48 @@
+From 716fcfa3203bc881b543916bdb9a17460951cd26 Mon Sep 17 00:00:00 2001
+From: "P. R. d. O" <d.ol.rod@protonmail.com>
+Date: Fri, 26 Nov 2021 07:13:32 -0600
+Subject: [PATCH] Fixing paths on tests
+
+---
+ tests/maintest.py  | 7 ++++++-
+ tests/speedtest.py | 7 ++++++-
+ 2 files changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/tests/maintest.py b/tests/maintest.py
+index 0e24ca4..3484437 100644
+--- a/tests/maintest.py
++++ b/tests/maintest.py
+@@ -1,6 +1,11 @@
+ import fleep
++import os
+ 
+-with open("testfile", "rb") as file:
++current_dir = os.path.realpath(os.path.join(os.getcwd(),
++                                            os.path.dirname(__file__)))
++
++with open(os.path.join(current_dir, "./testfile"),
++          "rb") as file:
+     info = fleep.get(file.read(128))
+ 
+ assert info.type == ["raster-image"]
+diff --git a/tests/speedtest.py b/tests/speedtest.py
+index 89338ab..829d563 100644
+--- a/tests/speedtest.py
++++ b/tests/speedtest.py
+@@ -1,7 +1,12 @@
+ import time
+ import fleep
++import os
+ 
+-with open("testfile", "rb") as file:
++current_dir = os.path.realpath(os.path.join(os.getcwd(),
++                                            os.path.dirname(__file__)))
++
++with open(os.path.join(current_dir, "./testfile"),
++          "rb") as file:
+     stream = file.read(128)
+ 
+ times = []
+-- 
+2.33.1
+
diff --git a/pkgs/development/python-modules/fleep/default.nix b/pkgs/development/python-modules/fleep/default.nix
new file mode 100644
index 0000000000000..04b607325136e
--- /dev/null
+++ b/pkgs/development/python-modules/fleep/default.nix
@@ -0,0 +1,36 @@
+{ lib
+, buildPythonPackage
+, fetchFromGitHub
+, python
+}:
+
+buildPythonPackage rec {
+  pname = "fleep";
+  version = "1.0.1";
+
+  # Pypi version does not have tests
+  src = fetchFromGitHub {
+    owner = "floyernick";
+    repo = "fleep-py";
+    rev = "994bc2c274482d80ab13d89d8f7343eb316d3e44";
+    sha256 = "sha256-TaU7njx98nxkhZawGMFqWj4g+yCtIX9aPWQHoamzfMY=";
+  };
+
+  patches = [
+    ./0001-Fixing-paths-on-tests.patch
+  ];
+
+  checkPhase = ''
+    ${python.interpreter} tests/maintest.py
+    ${python.interpreter} tests/speedtest.py
+  '';
+
+  pythonImportsCheck = [ "fleep" ];
+
+  meta = with lib; {
+    description = "File format determination library";
+    homepage = "https://github.com/floyernick/fleep-py";
+    license = licenses.mit;
+    maintainers = with maintainers; [ wolfangaukang ];
+  };
+}
diff --git a/pkgs/tools/networking/opendrop/default.nix b/pkgs/tools/networking/opendrop/default.nix
new file mode 100644
index 0000000000000..6a89372151057
--- /dev/null
+++ b/pkgs/tools/networking/opendrop/default.nix
@@ -0,0 +1,41 @@
+{ lib
+, buildPythonApplication
+, fetchPypi
+, fleep
+, libarchive-c
+, pillow
+, requests-toolbelt
+, setuptools
+, zeroconf }:
+
+buildPythonApplication rec {
+  pname = "opendrop";
+  version = "0.13.0";
+
+  src = fetchPypi {
+    inherit version pname;
+    sha256 = "sha256-FE1oGpL6C9iBhI8Zj71Pm9qkObJvSeU2gaBZwK1bTQc=";
+  };
+
+  propagatedBuildInputs = [
+    fleep
+    libarchive-c
+    pillow
+    requests-toolbelt
+    setuptools
+    zeroconf
+  ];
+
+  # There are tests, but getting the following error:
+  # nix_run_setup: error: argument action: invalid choice: 'test' (choose from 'receive', 'find', 'send')
+  # Opendrop works as intended though
+  doCheck = false;
+
+  meta = with lib; {
+    description = "An open Apple AirDrop implementation written in Python";
+    homepage = "https://owlink.org/";
+    license = licenses.gpl3Only;
+    maintainers = with maintainers; [ wolfangaukang ];
+    platforms = [ "x86_64-linux" ];
+  };
+}
diff --git a/pkgs/tools/networking/owl/default.nix b/pkgs/tools/networking/owl/default.nix
new file mode 100644
index 0000000000000..5a726c25a0272
--- /dev/null
+++ b/pkgs/tools/networking/owl/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, lib, fetchFromGitHub, cmake, libev, libnl, libpcap }:
+
+stdenv.mkDerivation rec {
+  pname = "owl";
+  version = "unstable-2022-01-30";
+
+  src = fetchFromGitHub {
+    owner = "seemoo-lab";
+    repo = "owl";
+    rev = "8e4e840b212ae5a09a8a99484be3ab18bad22fa7";
+    sha256 = "sha256-kFk+JFLGWGBu5FPH3qp/Bxa6t04f1kpeHz3H8GNF3fg=";
+    fetchSubmodules = true;
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ libev libnl libpcap ];
+
+  meta = with lib; {
+    description = "An open Apple Wireless Direct Link (AWDL) implementation written in C";
+    homepage = "https://owlink.org/";
+    license = licenses.gpl3Only;
+    maintainers = with maintainers; [ wolfangaukang ];
+    platforms = [ "x86_64-linux" ];
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 6130e5afc103f..1afea11174ce3 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -544,6 +544,10 @@ with pkgs;
 
   graph-easy = callPackage ../tools/graphics/graph-easy { };
 
+  opendrop = python3Packages.callPackage ../tools/networking/opendrop { };
+
+  owl = callPackage ../tools/networking/owl { };
+
   packer = callPackage ../development/tools/packer { };
 
   packr = callPackage ../development/libraries/packr { };
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 7424da883322b..1ba448f2a46fa 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -3027,6 +3027,8 @@ in {
 
   flax = callPackage ../development/python-modules/flax { };
 
+  fleep = callPackage ../development/python-modules/fleep { };
+
   flexmock = callPackage ../development/python-modules/flexmock { };
 
   flickrapi = callPackage ../development/python-modules/flickrapi { };