aboutsummaryrefslogtreecommitdiffstats
path: root/modules/tools/brave/default.nix
blob: d1b0d3ee0b4225fb6adcfc4a43a74a942ec6a7d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{ config, lib, pkgs, ... }:

{
	options.tools.brave = {
		enable = lib.mkEnableOption "Enables brave.";
	};

	config = lib.mkIf config.tools.brave.enable {
		home.packages = with pkgs; [
			# Modify the brave-browser.desktop entry to scale the UI
			(brave.overrideAttrs (old: {
				postInstall = (old.postInstall or "") + ''
					sed -i 's|^Exec=\(.*brave[^\n]*\)|Exec=\1 --force-device-scale-factor=1.2|' \
						$out/share/applications/brave-browser.desktop
				'';
			}))
		];

		home.sessionPath = [
			"${config.home.homeDirectory}/.local/bin"
		];

		home.file.".local/bin/brave" = {
			text = ''
#!/bin/sh
exec ${pkgs.brave}/bin/brave --force-device-scale-factor=1.2 "$@"
'';
			executable = true;
		};
	};
}