about summary refs log tree commit diff
path: root/home/profiles/browsing
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2023-12-21 18:20:06 +0900
committersefidel <contact@sefidel.net>2023-12-21 18:20:06 +0900
commitb0e86add0d5dbbba5a43e2ed9273cd5ef6701ada (patch)
treef364555385f36844286e6c1eecf6a264556d5540 /home/profiles/browsing
parent974f39faecfb2f4bd99b5d8ca00fef2ec1945098 (diff)
downloadnixrc-b0e86add0d5dbbba5a43e2ed9273cd5ef6701ada.tar.gz
nixrc-b0e86add0d5dbbba5a43e2ed9273cd5ef6701ada.zip
feat(home/browsing): use kagi
Diffstat (limited to 'home/profiles/browsing')
-rw-r--r--home/profiles/browsing/default.nix21
1 files changed, 16 insertions, 5 deletions
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 {