kha-white / manga-ocr

Optical character recognition for Japanese text, with the main focus being Japanese manga
Apache License 2.0
1.71k stars 89 forks source link

Create a Nix package #61

Open nonetrix opened 9 months ago

nonetrix commented 9 months ago

It would be nice if a nix package was created so it's easier to install on NixOS systems

nonetrix commented 9 months ago

I might look into doing this, but not really sure how to exactly but seems simple

stigertropes commented 8 months ago

i don't use nur and don't want to go through trying to maintain one pkgs in upstream nixos, but i made a nix package for this for my own use some time ago

if you use flakes it should be pretty easy to add it in your pkgs

also i use wayland and not xorg, so if you use xorg you can probably just add next to/replace wl-clipboard with xclip

default.nix ```nix { lib, buildPythonPackage, fetchPypi, fire, jaconv, loguru, numpy, pillow, torch, transformers, unidic-lite, pyperclip, fugashi, wl-clipboard, }: buildPythonPackage rec { pname = "manga-ocr"; version = "0.1.11"; src = fetchPypi { inherit pname version; sha256 = "sha256-Ic6AaSaEY1NaPHgF9xawj1gmrwWqf1NhmTs8NYKZsOs="; }; buildInputs = [wl-clipboard]; propagatedBuildInputs = [fire jaconv loguru numpy pillow pyperclip torch transformers unidic-lite fugashi]; postInstall = '' mv -v assets $out/lib/python3.11/site-packages/manga_ocr/ ''; makeWrapperArgs = [ "--prefix PATH : ${lib.makeBinPath [wl-clipboard]}" ]; meta = with lib; { homepage = "https://github.com/kha-white/manga-ocr"; description = "Manga OCR"; license = licenses.asl20; platforms = platforms.all; }; } ```
nonetrix commented 8 months ago

I use Wayland too so hopefully it works for me as well, I don't really know exactly how to make use of it, but I will try it. I assume you just import it like anything? I really need to read up on it more, doesn't look hard, I wouldn't mind possibly maintaining it if I can understand it eventually as I will like use it a lot