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 'modules/by-name/at/atuin/module.nix')
-rw-r--r--modules/by-name/at/atuin/module.nix16
1 files changed, 11 insertions, 5 deletions
diff --git a/modules/by-name/at/atuin/module.nix b/modules/by-name/at/atuin/module.nix
index 9e3f46a7..700f50fb 100644
--- a/modules/by-name/at/atuin/module.nix
+++ b/modules/by-name/at/atuin/module.nix
@@ -17,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";
@@ -37,14 +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")
+          ];
 
-          sync = {
+          sync = lib.mkIf cfg.enableAge {
             # The v2 sync API
             records = true;
           };
-          auto_sync = true;
-          sync_address = "https://atuin-sync.vhack.eu";
+          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";