Skip to content

Commit e10f8cd

Browse files
committed
Fix Chrome remote debugging launchers
1 parent 7e7ca69 commit e10f8cd

3 files changed

Lines changed: 35 additions & 3 deletions

File tree

nixos/imalison.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,15 @@
200200
"x-scheme-handler/https"
201201
"x-scheme-handler/google-chrome"
202202
];
203-
exec = "${pkgs.google-chrome}/bin/google-chrome-stable --remote-debugging-port=46649 --remote-allow-origins=http://127.0.0.1,http://localhost %U";
203+
exec = "${pkgs.google-chrome}/bin/google-chrome-stable --user-data-dir=/home/imalison/.cache/google-chrome-devtools --remote-debugging-port=46649 --remote-allow-origins=http://127.0.0.1,http://localhost %U";
204204
actions = {
205205
new-window = {
206206
name = "New Window";
207-
exec = "${pkgs.google-chrome}/bin/google-chrome-stable --remote-debugging-port=46649 --remote-allow-origins=http://127.0.0.1,http://localhost";
207+
exec = "${pkgs.google-chrome}/bin/google-chrome-stable --user-data-dir=/home/imalison/.cache/google-chrome-devtools --remote-debugging-port=46649 --remote-allow-origins=http://127.0.0.1,http://localhost";
208208
};
209209
new-private-window = {
210210
name = "New Incognito Window";
211-
exec = "${pkgs.google-chrome}/bin/google-chrome-stable --remote-debugging-port=46649 --remote-allow-origins=http://127.0.0.1,http://localhost --incognito";
211+
exec = "${pkgs.google-chrome}/bin/google-chrome-stable --user-data-dir=/home/imalison/.cache/google-chrome-devtools --remote-debugging-port=46649 --remote-allow-origins=http://127.0.0.1,http://localhost --incognito";
212212
};
213213
};
214214
};

nixos/overlay.nix

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,41 @@ let
3030
# hash = "sha256-OqvLiwB5TwZaxDvyN/+/+eueBdWNaYxd81cd5AZK/mA=";
3131
# npmDepsHash = "sha256-vy7osk3UAOEgsJx9jdcGe2wICOk5Urzxh1WLAHyHM+U=";
3232
# };
33+
# Chrome 136+ ignores remote debugging switches on the default profile.
34+
# Keep the wrapper in place, but do not inject remote debugging flags into
35+
# the normal Chrome launcher. The supported path for a real profile is the
36+
# Chrome remote debugging permission flow used by chrome-devtools-mcp
37+
# --auto-connect.
38+
chromeRemoteDebuggingFlags = [];
3339
placeholder = null; # Dummy binding to keep let block valid
3440
in
3541
{
42+
google-chrome = prev.symlinkJoin {
43+
name = prev.google-chrome.name;
44+
paths = [ prev.google-chrome ];
45+
nativeBuildInputs = [ final.makeWrapper ];
46+
postBuild = ''
47+
rm "$out/bin/google-chrome" "$out/bin/google-chrome-stable"
48+
49+
makeWrapper ${prev.google-chrome}/bin/google-chrome "$out/bin/google-chrome" \
50+
${final.lib.concatMapStringsSep " " (flag: "--add-flags ${final.lib.escapeShellArg flag}") chromeRemoteDebuggingFlags}
51+
52+
makeWrapper ${prev.google-chrome}/bin/google-chrome-stable "$out/bin/google-chrome-stable" \
53+
${final.lib.concatMapStringsSep " " (flag: "--add-flags ${final.lib.escapeShellArg flag}") chromeRemoteDebuggingFlags}
54+
55+
for desktopName in google-chrome.desktop com.google.Chrome.desktop; do
56+
desktopFile="$out/share/applications/$desktopName"
57+
if [ -f "$desktopFile" ]; then
58+
rm "$desktopFile"
59+
cp "${prev.google-chrome}/share/applications/$desktopName" "$desktopFile"
60+
substituteInPlace "$desktopFile" \
61+
--replace-fail "${prev.google-chrome}/bin/google-chrome-stable" "$out/bin/google-chrome-stable"
62+
fi
63+
done
64+
'';
65+
meta = prev.google-chrome.meta;
66+
};
67+
3668
# Fix poetry pbs-installer version constraint issue
3769
poetry = prev.poetry.overrideAttrs (oldAttrs: {
3870
dontCheckRuntimeDeps = true;
3.32 KB
Binary file not shown.

0 commit comments

Comments
 (0)