From b0e86add0d5dbbba5a43e2ed9273cd5ef6701ada Mon Sep 17 00:00:00 2001 From: sefidel Date: Thu, 21 Dec 2023 18:20:06 +0900 Subject: feat(home/browsing): use kagi --- home/profiles/browsing/default.nix | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'home/profiles/browsing/default.nix') diff --git a/home/profiles/browsing/default.nix b/home/profiles/browsing/default.nix index 30a804d..7ee3799 100644 --- a/home/profiles/browsing/default.nix +++ b/home/profiles/browsing/default.nix @@ -1,5 +1,8 @@ { config, lib, pkgs, ... }: -let cfg = config.profiles.browsing; +let + cfg = config.profiles.browsing; + + fixSopsPrefix = x: y: builtins.replaceStrings [ "%r" ] [ "/run/user/${toString x}" ] y; in { options.profiles.browsing = { @@ -18,11 +21,13 @@ in config = lib.mkIf cfg.enable { home.packages = with pkgs; [ firefox lynx ]; + sops.secrets.kagi-query = { }; + sops.secrets.kagi-session = { }; + programs.qutebrowser = { enable = true; searchEngines = { - DEFAULT = "https://searx.be/search?q={}"; g = "https://www.google.com/search?hl=en&q={}"; ddg = "https://www.duckduckgo.com/?q={}"; nw = "https://nixos.wiki/index.php?search={}"; @@ -39,15 +44,21 @@ in settings = import ./qutebrowser-settings.nix // { - url.default_page = "https://searx.be"; - url.start_pages = "https://searx.be"; - # mimeApps: open links in new window new_instance_open_target = "window"; } // 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 + ''; }; xdg.mimeApps = lib.mkIf pkgs.stdenv.isLinux { -- cgit 1.4.1