Skip to content

Commit

Permalink
feat: Patch Brave webapps
Browse files Browse the repository at this point in the history
The generated .desktop files seem to point to the brave binary on the nix
store at the time of creation, so for now I just sed them to the generic
executable on path
  • Loading branch information
lpchaim committed Sep 29, 2024
1 parent 79a41f0 commit 4b28c3f
Showing 1 changed file with 29 additions and 9 deletions.
38 changes: 29 additions & 9 deletions modules/home/gui/chromium.nix
Original file line number Diff line number Diff line change
@@ -1,16 +1,36 @@
{
config,
inputs,
lib,
pkgs,
...
}: let
inherit (inputs.home-manager.lib) hm;
in {
programs.chromium = {
enable = true;
commandLineArgs = [
"--disable-gpu-compositing" # @TODO Remove after NVIDIA figures this out
];
package = pkgs.brave;
};
}
in
lib.mkIf (config.my.modules.gui.enable) {
programs.chromium = {
enable = true;
commandLineArgs = [
"--disable-gpu-compositing" # @TODO Remove after NVIDIA figures this out
];
package = pkgs.brave;
};

home.activation.patchBraveWebapps = let
inherit (config.programs.chromium) package;
executable = package.meta.mainProgram;
script =
hm.dag.entryAfter
["writeBoundary"]
# bash
''
# Patches webapps so that they point to the executable on path
run --quiet \
find '${config.home.homeDirectory}/.local/share/applications' \
-type f -name 'brave-*.desktop' \
| xargs --no-run-if-empty \
sed --in-place 's,Exec=[^ ]*,Exec=${executable},g'
'';
in
lib.mkIf (package == pkgs.brave) script;
}

0 comments on commit 4b28c3f

Please sign in to comment.