about summary refs log tree commit diff
path: root/home
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
parent974f39faecfb2f4bd99b5d8ca00fef2ec1945098 (diff)
downloadnixrc-b0e86add0d5dbbba5a43e2ed9273cd5ef6701ada.tar.gz
nixrc-b0e86add0d5dbbba5a43e2ed9273cd5ef6701ada.zip
feat(home/browsing): use kagi
Diffstat (limited to 'home')
-rw-r--r--home/profiles/browsing/default.nix21
-rw-r--r--home/secrets/secrets.yaml8
2 files changed, 21 insertions, 8 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 {
diff --git a/home/secrets/secrets.yaml b/home/secrets/secrets.yaml
index 60dd583..19975f8 100644
--- a/home/secrets/secrets.yaml
+++ b/home/secrets/secrets.yaml
@@ -1,4 +1,6 @@
 sef-email-password: ENC[AES256_GCM,data:K1D+d8nly3POMLM1qHQPr0emF4qScEb1UjAyhaUd,iv:odkiOVPxckfsfcY5ZRuQ++L35kZ8cemnuRKWTUpjNWs=,tag:QwOs2oOxGTyy2kdIWyzSRA==,type:str]
+kagi-query: ENC[AES256_GCM,data:9Y/m+D66aCiUgiBMz1652Qjt532gxw1vy1hx1UXhysUJfv/xSCDLmlfZVjX4EVV9QzG9VZu5zGo9GFtYCIpq1CeNdqpmBoi8eQmg0AJPHAd60wGgl0qeq1AV,iv:BlBUk1jz9F51Sa7iibfYToBlLBEQDG7U2kidg9/fhW0=,tag:aBYY8m1v9DPm+FifD+3tGw==,type:str]
+kagi-session: ENC[AES256_GCM,data:T1lNYU8Tq2n7LfvKSw8zm8oFY1TDlB5GppxpiBPR8t9LaoULe+X/QIr69HEjIKUM/mQ8o8IUvOiqFGCpKiQg+Zy1y1lei+J8xFL2eSCJ/YOa7LJswg==,iv:VgNMeo8049LqnRpBVAR/Ba4FoPz5lpYyvBXm3OnnArA=,tag:pOLZP2JVaeWgzRZnEjVWlw==,type:str]
 sops:
     kms: []
     gcp_kms: []
@@ -23,8 +25,8 @@ sops:
             SDl5RTUvUXVSdmc0aEc0aFd2akdkY0UKJFEvPFe2xalBb5Y2fxSbCeB6vHf15OXw
             LzSmm+8T7kvCUvJG+TEu1qOaR16RSWHSv/A9F4IfmE0V8YTRdgbgrQ==
             -----END AGE ENCRYPTED FILE-----
-    lastmodified: "2023-09-14T11:26:18Z"
-    mac: ENC[AES256_GCM,data:ZjrurFQ3O4MM51i6XRnZjq5mf/Yq/cly5cWELafJnEliaoRl568C4EULKqAtO93njU2g/ej4Z7Ypg2t8xMoJJ6gbW1l76s1EzhsH5F1VJ1xr5OQ/hLx1/Zi4zekJCfac8pAH9jA4AaZ9dt4+CQiaz9pNyVumnc0OXLNd7KAvFUo=,iv:KSfResvF+LDAlGAMn5L89cn2Nm98ZD3kiQKQRjcu1oQ=,tag:S1L/w6BuomJsZzuVgJ2ZCA==,type:str]
+    lastmodified: "2023-12-21T09:16:20Z"
+    mac: ENC[AES256_GCM,data:wfB5eae3K04H6xQf5QE0g2+q2RlmqSgmxzHtPYiJcbK5R31+T8DUstwgvhPNRxnbuqYpi87Qt5L8yvQqYZHIBqJlZ+f18H1sIWyICnq7I6rSBcRsaJG5Pk10J/A3wP3JlSeWKr5mrrcu0z/R2tZHFNDXdtLTFo9PxAdM3hsSSRw=,iv:Kr04UVznkYXSgXcHoEebWaDsOx5viGQ+1046JFJsMzA=,tag:KZOZqdlu9BNvW/7WLeMVrg==,type:str]
     pgp: []
     unencrypted_suffix: _unencrypted
-    version: 3.7.3
+    version: 3.8.1