blob: e2baa0a353ca230665b186d683c7cd0edf22d70c (
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
{ config, inputs, lib, pkgs, ... }:
let
cfg = config.profiles.browsing;
fixSopsPrefix = x: y: builtins.replaceStrings [ "%r" ] [ "/run/user/${toString x}" ] y;
bemenuPrompt = "${pkgs.bemenu}/bin/bemenu -H 18 -l 5 -c -W 0.4 -B 3";
in
{
options.profiles.browsing = {
enable = lib.mkEnableOption
"A profile that enables a browser for the GUI and the terminal";
hiDpi = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Tweak the browsers for better readability on HiDPI screens
'';
};
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ lynx tor-browser ];
sops.secrets.kagi-query = { };
sops.secrets.kagi-session = { };
programs.qutebrowser = {
enable = true;
searchEngines = {
DEFAULT = "https://kagi.com/search?q={}";
g = "https://www.google.com/search?hl=en&q={}";
ddg = "https://www.duckduckgo.com/?q={}";
nw = "https://nixos.wiki/index.php?search={}";
ns = "https://search.nixos.org/options?channel=unstable&from=0size=50&sort=relevance&type=packages&query={}";
np = "https://search.nixos.org/packages?channel=unstable&from=0&size=50&sort=relevance&type=packages&query={}";
rd = "https://docs.rs/releases/search?query={}";
rp = "https://crates.io/search?q={}";
};
quickmarks = {
github = "https://github.com";
sourcehut = "https://sr.ht";
};
keyBindings = {
normal = {
"<Ctrl+L>" = "spawn --userscript qute-bitwarden -d='${bemenuPrompt} -p \"Bitwarden\"' -p='${bemenuPrompt} -p \"Bitwarden Master Passphrase Entry\" --password'";
};
};
settings = import ./qutebrowser-settings.nix // {
url.default_page = "https://kagi.com";
url.start_pages = "https://kagi.com";
# mimeApps: open links in new window
new_instance_open_target = "window";
# Allow clipboard rw access
content.javascript.clipboard = "access";
} // lib.optionalAttrs (cfg.hiDpi) {
qt.highdpi = true;
fonts.default_size = "12pt";
};
# extraConfig = ''
# with open('${fixSopsPrefix 1000 config.sops.secrets.kagi-query.path}') as f:
# c.url.searchengines['DEFAULT'] = f.readline()
# with open('${fixSopsPrefix 1000 config.sops.secrets.kagi-session.path}') as f:
# k_session = f.readline()
# c.url.default_page = k_session
# c.url.start_pages = k_session
# '';
};
programs.firefox = {
enable = true;
package = pkgs.firefox.override {
extraPolicies = {
# CaptivePortal = false;
DisableFirefoxStudies = true;
DisableTelemetry = true;
DontCheckDefaultBrowser = true;
OfferToSaveLogins = false;
OfferToSaveLoginsDefault = false;
UserMessaging = {
ExtensionRecommendations = false;
SkipOnboarding = true;
};
};
};
profiles.default = {
id = 0;
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
bitwarden
kagi-search
tridactyl
];
};
};
xdg.mimeApps = lib.mkIf pkgs.stdenv.isLinux {
enable = true;
defaultApplications = {
"x-scheme-handler/http" = [ "org.qutebrowser.qutebrowser.desktop" ];
"x-scheme-handler/https" = [ "org.qutebrowser.qutebrowser.desktop" ];
"text/html" = [ "org.qutebrowser.qutebrowser.desktop" ];
"x-scheme-handler/about" = [ "org.qutebrowser.qutebrowser.desktop" ];
"x-scheme-handler/unknown" = [ "org.qutebrowser.qutebrowser.desktop" ];
};
};
};
}
|