Something went wrong. Try again.
pop up a card on selections / screenshots to show you romaji and other info of kanji and kana
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990{ pkgs ? import <nixpkgs> { },}:let inherit (pkgs) lib stdenv; version = "0.1.0"; # the flake reads the git tree; a plain checkout also holds build output # (the root binaries, dist/, rendered cards) that must not reach the store src = lib.cleanSourceWith { src = lib.cleanSource ./.; filter = path: type: let rel = lib.removePrefix (toString ./. + "/") (toString path); in !(lib.elem rel [ "chirami" "chirami-ocr" "card.png" "dist" "result" ".tmp" "testdata/out" ".browser-artifacts" ]); }; common = { inherit version src; vendorHash = "sha256-pnwDZ7Yt7JJC6Fiv02lbPeI81DrmwxjLB4BBMevYdUc="; ldflags = [ "-s" "-w" ]; }; # the darwin backend is cgo; the linux one is pure go main = pkgs.buildGoModule ( common // { pname = "chirami"; subPackages = [ "cmd/chirami" ]; env.CGO_ENABLED = if stdenv.hostPlatform.isDarwin then "1" else "0"; } ); # the screenshot ocr helper, started by chirami on demand. on linux it runs # onnx models through onnxruntime (cgo), kept out of chirami itself ocrLinux = pkgs.buildGoModule ( common // { pname = "chirami-ocr"; subPackages = [ "cmd/chirami-ocr" ]; env.CGO_ENABLED = "1"; nativeBuildInputs = [ pkgs.makeWrapper ]; postInstall = '' wrapProgram $out/bin/chirami-ocr \ --set-default CHIRAMI_ORT_LIB ${pkgs.onnxruntime}/lib/libonnxruntime.so ''; } ); # on macos it is live text, which is swift-only ocrDarwin = stdenv.mkDerivation { pname = "chirami-ocr"; inherit version; src = ./macos/ocr; nativeBuildInputs = [ pkgs.swift ]; buildPhase = '' runHook preBuild swiftc -parse-as-library -O -o chirami-ocr main.swift runHook postBuild ''; installPhase = '' runHook preInstall install -Dm755 chirami-ocr $out/bin/chirami-ocr runHook postInstall ''; };inpkgs.symlinkJoin { name = "chirami-${version}"; paths = [ main (if stdenv.hostPlatform.isDarwin then ocrDarwin else ocrLinux) ]; meta = { description = "select japanese text, get furigana, romaji and dictionary entries at the pointer"; license = lib.licenses.gpl3Plus; mainProgram = "chirami"; platforms = lib.platforms.linux ++ lib.platforms.darwin; };}