16 stdenv.mkDerivation (finalAttrs: {
17 pname = "koodo-reader";
20 src = fetchFromGitHub {
22 repo = "koodo-reader";
23 rev = "v${finalAttrs.version}";
24 hash = "sha256-RtEL4ZVtNSqQShgHpjd1O/wgsXJOvceV+NhIWqexVAI=";
27 offlineCache = fetchYarnDeps {
28 yarnLock = "${finalAttrs.src}/yarn.lock";
29 hash = "sha256-58mxYt2wD6SGzhvo9c44CPmdX+/tLnbJCMPafo4txbY=";
39 ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
46 env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
48 # disable code signing on Darwin
49 env.CSC_IDENTITY_AUTO_DISCOVERY = "false";
52 cp -r ${electron.dist} electron-dist
53 chmod -R u+w electron-dist
54 yarn --offline run electron-builder --dir \
55 -c.electronDist=electron-dist \
56 -c.electronVersion=${electron.version}
62 ${lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
63 install -Dm644 assets/icons/256x256.png $out/share/icons/hicolor/256x256/apps/koodo-reader.png
64 install -Dm644 ${./mime-types.xml} $out/share/mime/packages/koodo-reader.xml
66 mkdir -p $out/share/lib/koodo-reader
67 cp -r dist/*-unpacked/{locales,resources{,.pak}} $out/share/lib/koodo-reader
70 ${lib.optionalString stdenv.hostPlatform.isDarwin ''
71 mkdir -p $out/Applications
72 cp -r dist/mac*/"Koodo Reader.app" $out/Applications
73 makeWrapper "$out/Applications/Koodo Reader.app/Contents/MacOS/Koodo Reader" $out/bin/koodo-reader
79 # we use makeShellWrapper instead of the makeBinaryWrapper provided by wrapGAppsHook for proper shell variable expansion
80 postFixup = lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
81 makeShellWrapper ${lib.getExe electron} $out/bin/koodo-reader \
82 --add-flags $out/share/lib/koodo-reader/resources/app.asar \
83 "''${gappsWrapperArgs[@]}" \
84 --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \
85 --set-default ELECTRON_IS_DEV 0 \
91 name = "koodo-reader";
92 desktopName = "Koodo Reader";
93 exec = "koodo-reader %U";
94 icon = "koodo-reader";
95 comment = finalAttrs.meta.description;
96 categories = [ "Office" ];
98 "application/epub+zip"
101 "application/x-mobipocket-ebook"
102 "application/vnd.amazon.ebook"
103 "application/vnd.amazon.ebook"
108 "application/x-fictionbook+xml"
110 startupWMClass = "Koodo Reader";
116 changelog = "https://github.com/troyeguo/koodo-reader/releases/tag/v${finalAttrs.version}";
117 description = "Cross-platform ebook reader";
119 A modern ebook manager and reader with sync and backup capacities
120 for Windows, macOS, Linux and Web
122 homepage = "https://github.com/troyeguo/koodo-reader";
123 license = lib.licenses.agpl3Only;
124 mainProgram = "koodo-reader";
125 maintainers = with lib.maintainers; [ tomasajt ];
126 platforms = electron.meta.platforms;