aboutsummaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--modules/by-name/at/atuin/module.nix16
-rw-r--r--modules/by-name/ta/taskwarrior/module.nix10
-rw-r--r--modules/common/default.nix7
3 files changed, 23 insertions, 10 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";
diff --git a/modules/by-name/ta/taskwarrior/module.nix b/modules/by-name/ta/taskwarrior/module.nix
index 4c174244..bb881768 100644
--- a/modules/by-name/ta/taskwarrior/module.nix
+++ b/modules/by-name/ta/taskwarrior/module.nix
@@ -76,6 +76,8 @@ in {
options.soispha.programs.taskwarrior = {
enable = lib.mkEnableOption "taskwarrior";
+ enableAge = lib.mkEnableOption "taskwarrior with age keys";
+
includeFiles = lib.mkOption {
type = lib.types.attrsOf lib.types.path;
description = "Extra files to include in the taskwarrior config";
@@ -108,17 +110,17 @@ in {
inherit mkHook;
};
- age.secrets.taskwarrior_sync_server_encryption_key = lib.mkIf cfg.enable {
+ age.secrets.taskwarrior_sync_server_encryption_key = lib.mkIf (cfg.enable && cfg.enableAge) {
file = ./secrets/sync_server_encryption_key.age;
mode = "700";
owner = "soispha";
group = "users";
};
- soispha.programs.taskwarrior.includeFiles.syncServerSecret = lib.mkIf cfg.enable config.age.secrets.taskwarrior_sync_server_encryption_key.path;
+ soispha.programs.taskwarrior.includeFiles.syncServerSecret = lib.mkIf (cfg.enable && cfg.enableAge) config.age.secrets.taskwarrior_sync_server_encryption_key.path;
home-manager.users.soispha = lib.mkIf cfg.enable {
- services.taskwarrior-sync = {
+ services.taskwarrior-sync = lib.mkIf cfg.enableAge {
enable = true;
package = pkgs.taskwarrior3;
};
@@ -148,7 +150,7 @@ in {
};
};
- sync.server = {
+ sync.server = lib.mkIf cfg.enableAge {
client_id = "a3619d43-031f-4f85-848f-5512804f9a1d";
url = "https://taskchampion.vhack.eu";
};
diff --git a/modules/common/default.nix b/modules/common/default.nix
index 1df2b928..bfc574e4 100644
--- a/modules/common/default.nix
+++ b/modules/common/default.nix
@@ -127,7 +127,10 @@
enable = true;
shell = pkgs.zsh;
};
- atuin.enable = true;
+ atuin = {
+ enable = true;
+ enableAge = lib.mkDefault true;
+ };
cargo.enable = true;
direnv.enable = true;
git.enable = true;
@@ -216,6 +219,8 @@
timewarrior.enable = true;
taskwarrior = {
enable = true;
+ enableAge = lib.mkDefault true;
+
hooks = import ./hooks {inherit pkgs lib config;};
};
tskm = {