Skip to content

Commit

Permalink
readest: init at 0.9.5
Browse files Browse the repository at this point in the history
  • Loading branch information
aucub committed Jan 16, 2025
1 parent 229bce0 commit f412151
Showing 1 changed file with 105 additions and 0 deletions.
105 changes: 105 additions & 0 deletions pkgs/by-name/re/readest/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
rustPlatform,
pnpm_9,
cargo-tauri,
nodejs,
pkg-config,
webkitgtk_4_1,
wrapGAppsHook3,
fetchFromGitHub,
gtk3,
librsvg,
openssl,
autoPatchelfHook,
makeWrapper,
lib,
desktop-file-utils,
nix-update-script,
xdg-utils,
}:

rustPlatform.buildRustPackage rec {
pname = "readest";
version = "0.9.5";

src = fetchFromGitHub {
owner = "readest";
repo = "readest";
tag = "v${version}";
hash = "sha256-JtxW3ngP+oHCE6E55+wUL3ptcJ86UEqj2LFXhDQW6/k=";
fetchSubmodules = true;
};

sourceRoot = "${src.name}/apps/readest-app";

pnpmDeps = pnpm_9.fetchDeps {
inherit pname version src;
hash = "sha256-YmuqMqO9AisSHv7iJK/ElQig/fF/+ngrqSzlvtnX2xc=";
};

pnpmRoot = "..";

cargoHash = "sha256-2Fx31kVJfQrOeGVtkL1ARCo+REbRKO1JBIZEZO93Lis=";

cargoRoot = "src-tauri";

buildAndTestSubdir = cargoRoot;

postPatch = ''
substituteInPlace $cargoRoot/Cargo.toml \
--replace-fail '"devtools"' '"devtools", "rustls-tls"'
substituteInPlace $cargoRoot/tauri.conf.json \
--replace-fail '"createUpdaterArtifacts": true' '"createUpdaterArtifacts": false' \
--replace-fail '"Readest"' '"readest"'
oldHash=$(sha256sum $cargoDepsCopy/tauri-plugin-deep-link/src/lib.rs | cut -d " " -f 1)
substituteInPlace $cargoDepsCopy/tauri-plugin-deep-link/src/lib.rs \
--replace-fail 'Command::new("update-desktop-database")' 'Command::new("${desktop-file-utils}/bin/update-desktop-database")' \
--replace-fail 'Command::new("xdg-mime")' 'Command::new("${xdg-utils}/bin/xdg-mime")'
substituteInPlace $cargoDepsCopy/tauri-plugin-deep-link/.cargo-checksum.json \
--replace-fail $oldHash $(sha256sum $cargoDepsCopy/tauri-plugin-deep-link/src/lib.rs | cut -d " " -f 1)
'';

preConfigure = ''
chmod -R +w ../..
'';

nativeBuildInputs = [
cargo-tauri.hook
nodejs
pnpm_9.configHook
pkg-config
wrapGAppsHook3
autoPatchelfHook
makeWrapper
];

buildInputs = [
webkitgtk_4_1
gtk3
librsvg
openssl
];

preBuild = ''
pnpm setup-pdfjs
'';

dontWrapGApps = true;

postFixup = ''
wrapProgram $out/bin/readest \
''${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;
};
}

0 comments on commit f412151

Please sign in to comment.