diff --git a/pkgs/by-name/re/readest/package.nix b/pkgs/by-name/re/readest/package.nix new file mode 100644 index 0000000000000..c6fe8883c8235 --- /dev/null +++ b/pkgs/by-name/re/readest/package.nix @@ -0,0 +1,98 @@ +{ + rustPlatform, + pnpm, + cargo-tauri, + glib-networking, + nodejs, + pkg-config, + webkitgtk_4_1, + wrapGAppsHook3, + fetchFromGitHub, + gtk3, + librsvg, + libappindicator, + openssl, + autoPatchelfHook, + makeWrapper, + lib, + desktop-file-utils, +}: + +rustPlatform.buildRustPackage rec { + pname = "readest"; + version = "0.9.3"; + + src = fetchFromGitHub { + owner = "readest"; + repo = "readest"; + tag = "v${version}"; + hash = "sha256-ksqYTPgjw+J5mum9q9vJP4RpNK+LE3tIHMiaWtWrPF8="; + fetchSubmodules = true; + }; + + sourceRoot = "${src.name}/apps/readest-app"; + + pnpmDeps = pnpm.fetchDeps { + inherit pname version src; + hash = "sha256-YmuqMqO9AisSHv7iJK/ElQig/fF/+ngrqSzlvtnX2xc="; + }; + + pnpmRoot = ".."; + + cargoHash = "sha256-pOSlbLT0UnSIdJ8ioJBxKQFr8QRf2+KL7iBYrYWzh/Y="; + + cargoRoot = "src-tauri"; + + buildAndTestSubdir = cargoRoot; + + postPatch = '' + substituteInPlace $cargoRoot/Cargo.toml \ + --replace-fail ', "devtools"' ', "rustls-tls"' + substituteInPlace $cargoRoot/tauri.conf.json \ + --replace-fail '"createUpdaterArtifacts": true' '"createUpdaterArtifacts": false' + ''; + + preConfigure = '' + chmod -R +w ../.. + ''; + + nativeBuildInputs = [ + cargo-tauri.hook + nodejs + pnpm.configHook + pkg-config + wrapGAppsHook3 + autoPatchelfHook + makeWrapper + ]; + + buildInputs = [ + glib-networking + webkitgtk_4_1 + gtk3 + librsvg + libappindicator + openssl + ]; + + preBuild = '' + pnpm setup-pdfjs + ''; + + dontWrapGApps = true; + + postFixup = '' + wrapProgram $out/bin/readest \ + ''${gappsWrapperArgs[@]} \ + --prefix PATH : ${lib.makeBinPath [ desktop-file-utils ]} + ''; + + meta = { + description = "Modern, feature-rich ebook reader"; + homepage = "https://github.com/readest/readest"; + mainProgram = "readest"; + license = with lib.licenses; [ agpl3Plus ]; + maintainers = with lib.maintainers; [ aucub ]; + platforms = lib.platforms.linux; + }; +}