1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00

feat(notemenu): use as flake package

This commit is contained in:
2023-07-04 10:12:34 +02:00
parent 0cbf18fb1a
commit e08ffb4d44
3 changed files with 30 additions and 20 deletions

28
packages/notemenu.nix Normal file
View File

@@ -0,0 +1,28 @@
{
writers,
lib,
rofi,
findutils,
coreutils,
noteDirectory ? "~/cloud/syncthing/obsidian",
currentDates ? false,
}:
writers.writeDashBin "notemenu" ''
set -efu
PATH=$PATH:${
lib.makeBinPath [rofi findutils coreutils]
}
cd ${noteDirectory}
note_file=$({
${lib.optionalString currentDates ''
echo $(date -I).md
echo $(date -I -d yesterday).md
''}
find . -not -path '*/.*' -type f -printf "%T@ %p\n" | sort --reverse --numeric-sort | cut --delimiter=" " --fields=2-
} | rofi -dmenu -i -p 'notes')
if test "$note_file"
then
alacritty --working-directory ${noteDirectory} -e "$EDITOR" "$note_file"
fi
''