From 7ae844836e645a0b1a4938ed4008ab41e7b014f7 Mon Sep 17 00:00:00 2001 From: Mihai Maruseac Date: Sun, 25 Feb 2024 16:00:39 -0800 Subject: [PATCH 1/2] maintainers: add mihaimaruseac Signed-off-by: Mihai Maruseac --- maintainers/maintainer-list.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 33d88965d81b..377dc2b2e74f 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -12700,6 +12700,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"; From d8303e30f5b2c682278a7dfafcc19de260784762 Mon Sep 17 00:00:00 2001 From: Mihai Maruseac Date: Sun, 25 Feb 2024 17:22:49 -0800 Subject: [PATCH 2/2] python3Packages.magika: init at 0.5.0 Magika is an AI powered fast and efficient file type identification released by Google (see https://opensource.googleblog.com/2024/02/magika-ai-powered-fast-and-efficient-file-type-identification.html). Signed-off-by: Mihai Maruseac --- .../python-modules/magika/default.nix | 54 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + pkgs/top-level/python-packages.nix | 2 + 3 files changed, 58 insertions(+) create mode 100644 pkgs/development/python-modules/magika/default.nix 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 75eca5eb3052..95fd0af8f6ba 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 545fe4a7dae3..edb87b35eebe 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 { };