fix: make taskwarrior available on both NixOS and standalone home-manager

This commit is contained in:
2026-01-14 22:57:27 +01:00
parent 2fcde8ddd1
commit 54114f99ab
4 changed files with 40 additions and 12 deletions

View File

@@ -21,6 +21,7 @@ with pkgs;
parallel parallel
pass pass
pnpm pnpm
python3
ripgrep ripgrep
signal-desktop signal-desktop
silver-searcher silver-searcher

View File

@@ -10,13 +10,36 @@ let
in in
{ {
imports = [ imports = [
inputs.sops-nix.homeManagerModules.sops
../../modules/dconf.nix ../../modules/dconf.nix
../../modules/git.nix ../../modules/git.nix
../../modules/k9s.nix ../../modules/k9s.nix
../../modules/keepassxc.nix ../../modules/keepassxc.nix
../../modules/browser ../../modules/browser
../../modules/taskwarrior.nix
]; ];
sops = {
age.keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt";
defaultSopsFile = "${inputs.nix-secrets}/secrets.yaml";
secrets = {
taskwarrior_sync_server_url = {};
taskwarrior_sync_server_client_id = {};
taskwarrior_sync_encryption_secret = {};
anki_sync_user = {};
anki_sync_key = {};
};
templates."taskrc.d/sync" = {
content = ''
sync.server.url=${config.sops.placeholder.taskwarrior_sync_server_url}
sync.server.client_id=${config.sops.placeholder.taskwarrior_sync_server_client_id}
sync.encryption_secret=${config.sops.placeholder.taskwarrior_sync_encryption_secret}
'';
};
};
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
home.stateVersion = "25.05"; home.stateVersion = "25.05";

View File

@@ -1,12 +1,24 @@
{ {
config, config,
lib,
pkgs, pkgs,
osConfig ? null,
... ...
}: }:
let
hmSopsAvailable = config ? sops && config.sops ? templates;
osSopsAvailable = osConfig != null && osConfig ? sops && osConfig.sops ? templates;
sopsAvailable = hmSopsAvailable || osSopsAvailable;
sopsTemplates = if hmSopsAvailable then config.sops.templates else osConfig.sops.templates;
in
{ {
warnings =
lib.optional (!sopsAvailable && config.programs.taskwarrior.enable)
"taskwarrior is enabled, but sops templates are not available. taskwarrior sync will not be configured.";
home.packages = with pkgs; [ home.packages = with pkgs; [
python314
libnotify libnotify
]; ];
@@ -35,17 +47,10 @@
package = taskwarrior3; package = taskwarrior3;
colorTheme = "dark-256"; colorTheme = "dark-256";
config = { config = {
# sync = {
# server.url = "${builtins.readFile config.sops.secrets."taskwarrior_sync_server_url".path}";
# server.client_id = "${builtins.readFile
# config.sops.secrets."taskwarrior_sync_server_client_id".path
# }";
# encryption_secret = "${builtins.readFile
# config.sops.secrets."taskwarrior_sync_encryption_secret".path
# }";
# };
recurrence = "off"; recurrence = "off";
}; };
extraConfig = "include ${config.sops.templates."taskrc.d/sync".path}"; extraConfig = lib.optionalString sopsAvailable ''
include ${sopsTemplates."taskrc.d/sync".path}
'';
}; };
} }

View File

@@ -16,7 +16,6 @@ in
}; };
config = { config = {
sops = { sops = {
validateSopsFiles = false;
defaultSopsFile = "${builtins.toString inputs.nix-secrets}/secrets.yaml"; defaultSopsFile = "${builtins.toString inputs.nix-secrets}/secrets.yaml";
defaultSopsFormat = "yaml"; defaultSopsFormat = "yaml";
age.keyFile = "/home/${cfg.username}/.config/sops/age/keys.txt"; age.keyFile = "/home/${cfg.username}/.config/sops/age/keys.txt";