about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--maintainers/maintainer-list.nix6
-rw-r--r--pkgs/development/python-modules/magika/default.nix54
-rw-r--r--pkgs/top-level/all-packages.nix2
-rw-r--r--pkgs/top-level/python-packages.nix2
4 files changed, 64 insertions, 0 deletions
diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix
index 337629c1ef37..53ae8880787d 100644
--- a/maintainers/maintainer-list.nix
+++ b/maintainers/maintainer-list.nix
@@ -12705,6 +12705,12 @@
     githubId = 635591;
     name = "Shahar Dawn Or";
   };
+  mihaimaruseac = {
+    email = "mihaimaruseac@gmail.com";
+    github = "mihaimaruseac";
+    githubId = 323199;
+    name = "Mihai Maruseac";
+  };
   mihnea-s = {
     email = "mihn.stn@gmail.com";
     github = "mihnea-s";
diff --git a/pkgs/development/python-modules/magika/default.nix b/pkgs/development/python-modules/magika/default.nix
new file mode 100644
index 000000000000..6e4099004317
--- /dev/null
+++ b/pkgs/development/python-modules/magika/default.nix
@@ -0,0 +1,54 @@
+{ lib
+, buildPythonPackage
+, click
+, fetchPypi
+, magika
+, numpy
+, onnxruntime
+, poetry-core
+, python-dotenv
+, pythonOlder
+, stdenv
+, tabulate
+, testers
+, tqdm
+}:
+
+buildPythonPackage rec {
+  pname = "magika";
+  version = "0.5.0";
+  pyproject = true;
+  disabled = pythonOlder "3.9";
+
+  src = fetchPypi {
+    inherit pname version;
+    hash = "sha256-r6C7iDCG/o3JEvweQGb4upr+LuHvmNtkwtduZGehCsc=";
+  };
+
+  nativeBuildInputs = [
+    poetry-core
+  ];
+
+  propagatedBuildInputs = [
+    click
+    numpy
+    onnxruntime
+    python-dotenv
+    tabulate
+    tqdm
+  ];
+
+  pythonImportsCheck = [ "magika" ];
+
+  passthru.tests.version = testers.testVersion { package = magika; };
+
+  meta = with lib; {
+    description = "Magika: Detect file content types with deep learning";
+    homepage = "https://github.com/google/magika";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ mihaimaruseac ];
+    mainProgram = "magika";
+    # Currently, disabling on AArch64 as it onnx runtime crashes on ofborg
+    broken = stdenv.isAarch64 && stdenv.isLinux;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 02964f0d1fd3..750265b61931 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -1085,6 +1085,8 @@ with pkgs;
 
   ruler = callPackage ../tools/security/ruler { };
 
+  magika = with python3Packages; toPythonApplication magika;
+
   mblock-mlink = callPackage ../development/tools/mblock-mlink { };
 
   mod = callPackage ../development/tools/mod { };
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 19a56ac7ff08..4b2fc2b9df41 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -6911,6 +6911,8 @@ self: super: with self; {
 
   magic-wormhole-transit-relay = callPackage ../development/python-modules/magic-wormhole-transit-relay { };
 
+  magika = callPackage ../development/python-modules/magika { };
+
   mahotas = callPackage ../development/python-modules/mahotas { };
 
   mailcap-fix = callPackage ../development/python-modules/mailcap-fix { };