about summary refs log tree commit diff stats
path: root/modules/by-name/at/atuin/module.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/by-name/at/atuin/module.nix29
1 files changed, 23 insertions, 6 deletions
diff --git a/modules/by-name/at/atuin/module.nix b/modules/by-name/at/atuin/module.nix
index 2061fd71..700f50fb 100644
--- a/modules/by-name/at/atuin/module.nix
+++ b/modules/by-name/at/atuin/module.nix
@@ -1,3 +1,12 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
 {
   config,
   lib,
@@ -8,10 +17,12 @@
 in {
   options.soispha.programs.atuin = {
     enable = lib.mkEnableOption "atuin";
+
+    enableAge = lib.mkEnableOption "atuin with age keys";
   };
 
   config = lib.mkIf cfg.enable {
-    age.secrets.atuin_encryption_key = {
+    age.secrets.atuin_encryption_key = lib.mkIf cfg.enableAge {
       file = ./secrets/encryption_key.age;
       mode = "700";
       owner = "soispha";
@@ -28,12 +39,18 @@ in {
         # We can do this on our own.
         enableZshIntegration = false;
         settings = {
-          key_path = "${config.age.secrets.atuin_encryption_key.path}";
+          key_path = lib.mkMerge [
+            (lib.mkIf cfg.enableAge "${config.age.secrets.atuin_encryption_key.path}")
+            (lib.mkIf (!cfg.enableAge)
+              "${config.home-manager.users.soispha.xdg.dataHome}/atuin/atuin_secret_key.key")
+          ];
 
-          # TODO: Setup a self-hosted sync server. <2024-10-18>
-          session_path = "";
-          auto_sync = false;
-          sync_address = "";
+          sync = lib.mkIf cfg.enableAge {
+            # The v2 sync API
+            records = true;
+          };
+          auto_sync = lib.mkIf cfg.enableAge true;
+          sync_address = lib.mkIf cfg.enableAge "https://atuin-sync.vhack.eu";
 
           # Use the rather reasonable syntax of `skim` to search.
           search_mode = "skim";