Create scripts to add to and edit daily todo files
All checks were successful
/ check (push) Successful in 1m21s

This commit is contained in:
Oliver Davies 2025-05-14 22:46:00 +01:00
parent 3a8388b09f
commit 24fc8e6845
7 changed files with 66 additions and 0 deletions

View file

@ -37,6 +37,7 @@
];
};
todos.enable = true;
zsh.enable = true;
};

View file

@ -44,6 +44,7 @@
];
};
todos.enable = true;
zsh.enable = true;
};

View file

@ -11,6 +11,7 @@
./ranger.nix
./scripts
./starship.nix
./todos.nix
./tmux.nix
./tmux-sessionizer.nix
./zsh

View file

@ -0,0 +1,36 @@
{
config,
lib,
pkgs,
...
}:
let
name = "todos";
cfg = config.cli.${name};
inherit (lib) mkOption types;
in
{
options.cli.${name} = {
enable = lib.mkEnableOption "Enable ${name}";
directory = mkOption {
default = "${config.xdg.userDirs.documents}/todos";
type = types.str;
};
};
config = lib.mkIf cfg.enable {
home = {
packages = with pkgs; [
todos-add
todos-edit
];
sessionVariables = {
TODOS_DIRECTORY = cfg.directory;
};
};
};
}

View file

@ -12,6 +12,8 @@ in
displayselect = callPackage ./displayselect { };
notes = callPackage ./notes { };
passmenu-otp = callPackage ./passmenu-otp.nix { };
todos-add = callPackage ./todos/todos-add.nix { };
todos-edit = callPackage ./todos/todos-edit.nix { };
tmux-sessionizer = callPackage ./tmux-sessionizer { };
upload-to-files = callPackage ./upload-to-files.nix { };

13
pkgs/todos/todos-add.nix Normal file
View file

@ -0,0 +1,13 @@
{ pkgs, ... }:
pkgs.writeShellApplication {
name = "todos-add";
text = ''
TODOS_DIRECTORY="''${TODOS_DIRECTORY:-"$XDG_DOCUMENTS_DIR/todos"}"
export TODOS_DIRECTORY
echo "$*" >> "$TODOS_DIRECTORY/$(date +%Y-%m-%d).txt"
'';
}

12
pkgs/todos/todos-edit.nix Normal file
View file

@ -0,0 +1,12 @@
{ pkgs, ... }:
pkgs.writeShellApplication {
name = "todos-edit";
text = ''
TODOS_DIRECTORY="''${TODOS_DIRECTORY:-"$XDG_DOCUMENTS_DIR/todos"}"
export TODOS_DIRECTORY
"$EDITOR" "$TODOS_DIRECTORY/$(date +%Y-%m-%d).txt";
'';
}