thorium-reader: add .app bundle on macOS (#536588)
This commit is contained in:
@@ -814,6 +814,12 @@
|
||||
github = "aftix";
|
||||
githubId = 4008299;
|
||||
};
|
||||
agarmu = {
|
||||
name = "Mukul Agarwal";
|
||||
email = "vcs@agarmu.com";
|
||||
github = "agarmu";
|
||||
githubId = 55563106;
|
||||
};
|
||||
agbrooks = {
|
||||
email = "andrewgrantbrooks@gmail.com";
|
||||
github = "agbrooks";
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
buildNpmPackage,
|
||||
fetchFromGitHub,
|
||||
nodejs_24,
|
||||
makeWrapper,
|
||||
makeShellWrapper,
|
||||
makeBinaryWrapper,
|
||||
electron,
|
||||
copyDesktopItems,
|
||||
makeDesktopItem,
|
||||
desktopToDarwinBundle,
|
||||
}:
|
||||
|
||||
buildNpmPackage (finalAttrs: {
|
||||
@@ -24,23 +27,39 @@ buildNpmPackage (finalAttrs: {
|
||||
};
|
||||
|
||||
env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
|
||||
|
||||
# makeBinaryWrapper is required on Darwin since MacOS is confuses itself
|
||||
# into thinking it needs Rosetta 2 if it encounters a non-MachO executable
|
||||
# in a .app bundle.
|
||||
# Simultaneously, we need makeShellWrapper on linux platforms to pass
|
||||
# electron-specific flags.
|
||||
nativeBuildInputs = [
|
||||
makeWrapper
|
||||
copyDesktopItems
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isLinux [
|
||||
makeShellWrapper
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
makeBinaryWrapper
|
||||
desktopToDarwinBundle
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
install -Dpm644 resources/icon.png $out/share/icons/thorium-reader.png
|
||||
postInstall =
|
||||
let
|
||||
ozoneFlags = lib.optionalString stdenv.hostPlatform.isLinux ''--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}"'';
|
||||
in
|
||||
''
|
||||
install -Dpm644 resources/icon.png $out/share/icons/thorium-reader.png
|
||||
|
||||
cp -r dist/* $out/lib/node_modules/EDRLab.ThoriumReader/
|
||||
cp -r dist/* $out/lib/node_modules/EDRLab.ThoriumReader/
|
||||
|
||||
makeWrapper '${lib.getExe electron}' "$out/bin/thorium-reader" \
|
||||
--add-flags $out/lib/node_modules/EDRLab.ThoriumReader \
|
||||
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \
|
||||
--set-default ELECTRON_IS_DEV 0 \
|
||||
--inherit-argv0
|
||||
'';
|
||||
${
|
||||
if stdenv.hostPlatform.isDarwin then "makeBinaryWrapper" else "makeWrapper"
|
||||
} '${lib.getExe electron}' "$out/bin/thorium-reader" \
|
||||
--add-flags $out/lib/node_modules/EDRLab.ThoriumReader \
|
||||
${ozoneFlags} \
|
||||
--set-default ELECTRON_IS_DEV 0 \
|
||||
--inherit-argv0
|
||||
'';
|
||||
|
||||
desktopItems = [
|
||||
(makeDesktopItem {
|
||||
@@ -71,7 +90,10 @@ buildNpmPackage (finalAttrs: {
|
||||
description = "EPUB reader";
|
||||
homepage = "https://www.edrlab.org/software/thorium-reader/";
|
||||
license = lib.licenses.bsd3;
|
||||
maintainers = with lib.maintainers; [ YodaDaCoda ];
|
||||
maintainers = with lib.maintainers; [
|
||||
YodaDaCoda
|
||||
agarmu
|
||||
];
|
||||
platforms = lib.platforms.all;
|
||||
mainProgram = "thorium-reader";
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user