feat(taskwarrior): add enable option
This commit is contained in:
@@ -63,7 +63,6 @@
|
|||||||
bash.addBinToPath = true;
|
bash.addBinToPath = true;
|
||||||
};
|
};
|
||||||
anki.enable = true;
|
anki.enable = true;
|
||||||
anki.enable = true;
|
|
||||||
k8s.k9s.enable = true;
|
k8s.k9s.enable = true;
|
||||||
taskwarrior.enable = true;
|
taskwarrior.enable = true;
|
||||||
audio.enable = true;
|
audio.enable = true;
|
||||||
|
|||||||
@@ -61,6 +61,7 @@
|
|||||||
anki.enable = true;
|
anki.enable = true;
|
||||||
k8s.k9s.enable = true;
|
k8s.k9s.enable = true;
|
||||||
taskwarrior.enable = true;
|
taskwarrior.enable = true;
|
||||||
|
secrets.enable = true;
|
||||||
my.yubikey.enable = true;
|
my.yubikey.enable = true;
|
||||||
audio.enable = true;
|
audio.enable = true;
|
||||||
ssh.enable = true;
|
ssh.enable = true;
|
||||||
|
|||||||
@@ -90,6 +90,7 @@
|
|||||||
redis.enable = true;
|
redis.enable = true;
|
||||||
};
|
};
|
||||||
anki.enable = true;
|
anki.enable = true;
|
||||||
|
taskwarrior.enable = true;
|
||||||
k8s.enable = true;
|
k8s.enable = true;
|
||||||
shell.enable = true;
|
shell.enable = true;
|
||||||
my.stylix.enable = true;
|
my.stylix.enable = true;
|
||||||
|
|||||||
@@ -10,70 +10,76 @@
|
|||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
cfg = config.taskwarrior;
|
||||||
sops = myUtils.sopsAvailability config osConfig;
|
sops = myUtils.sopsAvailability config osConfig;
|
||||||
standalone = osConfig == null;
|
standalone = osConfig == null;
|
||||||
in
|
in
|
||||||
lib.optionalAttrs standalone {
|
{
|
||||||
sops = {
|
options.taskwarrior.enable = lib.mkEnableOption "taskwarrior";
|
||||||
secrets = myUtils.mkSopsSecrets "${toString inputs.nix-secrets}/secrets" null {
|
|
||||||
taskwarrior = [
|
config = lib.mkIf cfg.enable (
|
||||||
"sync-server-url"
|
lib.optionalAttrs standalone {
|
||||||
"sync-server-client-id"
|
sops = {
|
||||||
"sync-encryption-secret"
|
secrets = myUtils.mkSopsSecrets "${toString inputs.nix-secrets}/secrets" null {
|
||||||
|
taskwarrior = [
|
||||||
|
"sync-server-url"
|
||||||
|
"sync-server-client-id"
|
||||||
|
"sync-encryption-secret"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
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"}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// {
|
||||||
|
warnings =
|
||||||
|
lib.optional (!sops.available)
|
||||||
|
"taskwarrior is enabled, but sops templates are not available. taskwarrior sync will not be configured.";
|
||||||
|
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
libnotify
|
||||||
|
taskopen
|
||||||
|
python3
|
||||||
];
|
];
|
||||||
};
|
|
||||||
|
|
||||||
templates."taskrc.d/sync" = {
|
home.file = {
|
||||||
content = ''
|
".config/task/taskrc" = {
|
||||||
sync.server.url=${config.sops.placeholder."taskwarrior/sync-server-url"}
|
force = true;
|
||||||
sync.server.client_id=${config.sops.placeholder."taskwarrior/sync-server-client-id"}
|
source = dotsPath + "/.config/task/taskrc";
|
||||||
sync.encryption_secret=${config.sops.placeholder."taskwarrior/sync-encryption-secret"}
|
};
|
||||||
'';
|
".config/task/taskrc.d/aliases".source = dotsPath + "/.config/task/taskrc.d/aliases";
|
||||||
};
|
".config/task/taskrc.d/colors".source = dotsPath + "/.config/task/taskrc.d/colors";
|
||||||
};
|
".config/task/taskrc.d/contexts".source = dotsPath + "/.config/task/taskrc.d/contexts";
|
||||||
}
|
".config/task/taskrc.d/reports".source = dotsPath + "/.config/task/taskrc.d/reports";
|
||||||
// {
|
".config/task/taskrc.d/udas".source = dotsPath + "/.config/task/taskrc.d/udas";
|
||||||
|
".config/task/taskrc.d/urgency".source = dotsPath + "/.config/task/taskrc.d/urgency";
|
||||||
warnings =
|
".local/share/task/hooks/on-exit.sync.py" = {
|
||||||
lib.optional (!sops.available && config.programs.taskwarrior.enable)
|
source = dotsPath + "/.local/share/task/hooks/on-exit.sync.py";
|
||||||
"taskwarrior is enabled, but sops templates are not available. taskwarrior sync will not be configured.";
|
};
|
||||||
|
".local/share/task/scripts/sync-and-notify.sh" = {
|
||||||
home.packages = with pkgs; [
|
source = dotsPath + "/.local/share/task/scripts/sync-and-notify.sh";
|
||||||
libnotify
|
executable = true;
|
||||||
taskopen
|
};
|
||||||
python3
|
};
|
||||||
];
|
|
||||||
|
programs.taskwarrior = with pkgs; {
|
||||||
home.file = {
|
enable = true;
|
||||||
".config/task/taskrc" = {
|
package = taskwarrior3;
|
||||||
force = true;
|
colorTheme = "dark-256";
|
||||||
source = dotsPath + "/.config/task/taskrc";
|
config = {
|
||||||
};
|
recurrence = "off";
|
||||||
".config/task/taskrc.d/aliases".source = dotsPath + "/.config/task/taskrc.d/aliases";
|
reserved.lines = 3;
|
||||||
".config/task/taskrc.d/colors".source = dotsPath + "/.config/task/taskrc.d/colors";
|
};
|
||||||
".config/task/taskrc.d/contexts".source = dotsPath + "/.config/task/taskrc.d/contexts";
|
extraConfig = lib.optionalString sops.available ''
|
||||||
".config/task/taskrc.d/reports".source = dotsPath + "/.config/task/taskrc.d/reports";
|
include ${sops.templates."taskrc.d/sync".path}
|
||||||
".config/task/taskrc.d/udas".source = dotsPath + "/.config/task/taskrc.d/udas";
|
'';
|
||||||
".config/task/taskrc.d/urgency".source = dotsPath + "/.config/task/taskrc.d/urgency";
|
};
|
||||||
".local/share/task/hooks/on-exit.sync.py" = {
|
}
|
||||||
source = dotsPath + "/.local/share/task/hooks/on-exit.sync.py";
|
);
|
||||||
};
|
|
||||||
".local/share/task/scripts/sync-and-notify.sh" = {
|
|
||||||
source = dotsPath + "/.local/share/task/scripts/sync-and-notify.sh";
|
|
||||||
executable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.taskwarrior = with pkgs; {
|
|
||||||
enable = true;
|
|
||||||
package = taskwarrior3;
|
|
||||||
colorTheme = "dark-256";
|
|
||||||
config = {
|
|
||||||
recurrence = "off";
|
|
||||||
reserved.lines = 3; # without this I would have to scroll up 3 lines
|
|
||||||
};
|
|
||||||
extraConfig = lib.optionalString sops.available ''
|
|
||||||
include ${sops.templates."taskrc.d/sync".path}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
{ config, ... }:
|
{ lib, config, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
cfg = config.taskwarrior;
|
||||||
inherit (config.secrets) owner;
|
inherit (config.secrets) owner;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
config = {
|
options.taskwarrior.enable = lib.mkEnableOption "taskwarrior";
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
secrets.groups.taskwarrior = [
|
secrets.groups.taskwarrior = [
|
||||||
"sync-server-url"
|
"sync-server-url"
|
||||||
"sync-server-client-id"
|
"sync-server-client-id"
|
||||||
|
|||||||
Reference in New Issue
Block a user