From d7e055443e78804c6647d72c90a9e7238de251b9 Mon Sep 17 00:00:00 2001 From: aucub <78630225+aucub@users.noreply.github.com> Date: Fri, 24 Jan 2025 06:35:28 +0800 Subject: [PATCH] readest: init at 0.9.7 --- pkgs/by-name/re/readest/package.nix | 98 +++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 pkgs/by-name/re/readest/package.nix diff --git a/pkgs/by-name/re/readest/package.nix b/pkgs/by-name/re/readest/package.nix new file mode 100644 index 0000000000000..b11c87f611d52 --- /dev/null +++ b/pkgs/by-name/re/readest/package.nix @@ -0,0 +1,98 @@ +{ + rustPlatform, + pnpm_9, + cargo-tauri, + nodejs, + pkg-config, + webkitgtk_4_1, + wrapGAppsHook3, + fetchFromGitHub, + gtk3, + librsvg, + openssl, + autoPatchelfHook, + lib, + nix-update-script, + moreutils, + jq, +}: + +rustPlatform.buildRustPackage rec { + pname = "readest"; + version = "0.9.7"; + + src = fetchFromGitHub { + owner = "readest"; + repo = "readest"; + tag = "v${version}"; + hash = "sha256-2mxWF+Lel1PFPHxf5b9IhWUgg2RHiTZjb7QHvVwZ4Uw="; + fetchSubmodules = true; + }; + + postUnpack = '' + chmod -R +w . + ''; + + sourceRoot = "${src.name}/apps/readest-app"; + + pnpmDeps = pnpm_9.fetchDeps { + inherit pname version src; + hash = "sha256-p5G9h4DOonwfe2B7Duy4/YbKwv2pmE6RxsnILYIOsT8="; + }; + + pnpmRoot = "../.."; + + cargoHash = "sha256-KoF6ks3G3XkcjGbJH3qT9xjx+iX2/3Ph/d0I0VGj5L8="; + + cargoRoot = "../.."; + + buildAndTestSubdir = "src-tauri"; + + postPatch = '' + substituteInPlace src-tauri/Cargo.toml \ + --replace-fail '"devtools"' '"devtools", "rustls-tls"' + substituteInPlace src-tauri/tauri.conf.json \ + --replace-fail '"createUpdaterArtifacts": true' '"createUpdaterArtifacts": false' \ + --replace-fail '"Readest"' '"readest"' + jq 'del(.plugins."deep-link")' src-tauri/tauri.conf.json | sponge src-tauri/tauri.conf.json + ''; + + nativeBuildInputs = [ + cargo-tauri.hook + nodejs + pnpm_9.configHook + pkg-config + wrapGAppsHook3 + autoPatchelfHook + moreutils + jq + ]; + + buildInputs = [ + webkitgtk_4_1 + gtk3 + librsvg + openssl + ]; + + preBuild = '' + pnpm setup-pdfjs + ''; + + preFixup = '' + gappsWrapperArgs+=( + --set-default WEBKIT_DISABLE_DMABUF_RENDERER 1 + ) + ''; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Modern, feature-rich ebook reader"; + homepage = "https://github.com/readest/readest"; + mainProgram = "readest"; + license = lib.licenses.agpl3Plus; + maintainers = with lib.maintainers; [ aucub ]; + platforms = lib.platforms.linux; + }; +}