about summary refs log tree commit diff stats
path: root/modules/by-name/at/atuin/module.nix
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-05-16 18:13:38 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-05-16 18:13:38 +0200
commitf0954b3735b0f7deac6fe5626c72b09a407b023d (patch)
treea3f3c8dac6e5a468fb71d3f435ae42c7ad0a0685 /modules/by-name/at/atuin/module.nix
parentmodules/common: Don't always persist `/var/{lib/nixos,log}` (diff)
downloadnixos-config-f0954b3735b0f7deac6fe5626c72b09a407b023d.zip
modules/{atuin,taskwarrior}: Make enabling age configurable
A VM/test without age keys still needs to be able to use this modules.
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";