From 076474254a07f564601495498d10ff6f14038565 Mon Sep 17 00:00:00 2001 From: Mukul Agarwal Date: Sat, 27 Jun 2026 20:25:06 -0400 Subject: [PATCH 1/4] thorium-reader: add .app bundle on Darwin this makes it easier for those using thorium on macOS to use the application --- pkgs/by-name/th/thorium-reader/package.nix | 42 ++++++++++++++++------ 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/pkgs/by-name/th/thorium-reader/package.nix b/pkgs/by-name/th/thorium-reader/package.nix index 13ae3960b747..80bd319bd2b8 100644 --- a/pkgs/by-name/th/thorium-reader/package.nix +++ b/pkgs/by-name/th/thorium-reader/package.nix @@ -1,12 +1,15 @@ { lib, + stdenv, buildNpmPackage, fetchFromGitHub, nodejs_24, - makeWrapper, + makeShellWrapper, + makeBinaryWrapper, electron, copyDesktopItems, makeDesktopItem, + desktopToDarwinBundle, }: buildNpmPackage (finalAttrs: { @@ -24,23 +27,40 @@ buildNpmPackage (finalAttrs: { }; env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; + # makeBinaryWrapper is preferred on Darwin since the OS may confuse 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 { From 75736aba2c23440c48e9d5a967576b9f9982f907 Mon Sep 17 00:00:00 2001 From: Mukul Agarwal Date: Sat, 27 Jun 2026 21:54:53 -0400 Subject: [PATCH 2/4] maintainers: add agarmu --- maintainers/maintainer-list.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 3b5e3f4959cf..d22d2097e09e 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -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"; From e917e99234588f2f44690516559b94f354684426 Mon Sep 17 00:00:00 2001 From: Mukul Agarwal Date: Sat, 27 Jun 2026 21:55:36 -0400 Subject: [PATCH 3/4] thorium-reader: add agarmu as maintainer --- pkgs/by-name/th/thorium-reader/package.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/th/thorium-reader/package.nix b/pkgs/by-name/th/thorium-reader/package.nix index 80bd319bd2b8..5fe5efed4472 100644 --- a/pkgs/by-name/th/thorium-reader/package.nix +++ b/pkgs/by-name/th/thorium-reader/package.nix @@ -91,7 +91,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"; }; From 640e8731f3d36d44b58e166cf32ac8a4ce71948a Mon Sep 17 00:00:00 2001 From: Mukul Agarwal Date: Mon, 29 Jun 2026 20:37:47 -0400 Subject: [PATCH 4/4] thorium-reader: format comment Co-authored-by: Sandro --- pkgs/by-name/th/thorium-reader/package.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/th/thorium-reader/package.nix b/pkgs/by-name/th/thorium-reader/package.nix index 5fe5efed4472..e345900043fa 100644 --- a/pkgs/by-name/th/thorium-reader/package.nix +++ b/pkgs/by-name/th/thorium-reader/package.nix @@ -27,10 +27,9 @@ buildNpmPackage (finalAttrs: { }; env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; - # makeBinaryWrapper is preferred on Darwin since the OS may confuse itself + # 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 - + # in a .app bundle. # Simultaneously, we need makeShellWrapper on linux platforms to pass # electron-specific flags. nativeBuildInputs = [