add archutils and initial utility

add an archutils subdirectory and a shell script that generates a nice
pdf for everything I have to do for the day
This commit is contained in:
stupidcomputer 2024-08-26 17:40:32 -05:00
parent d16d8f2991
commit c015833774
3 changed files with 131 additions and 0 deletions

View File

@ -46,6 +46,8 @@
dunst
libnotify
ffmpeg
(pkgs.callPackage ../../builds/archutils.nix {})
];
services.hardware.bolt.enable = true; # thunderbolt support

39
builds/archutils.nix Normal file
View File

@ -0,0 +1,39 @@
{ stdenv
, lib
, pkgs
, makeWrapper
, sxhkd
, bash
, feh
, jq
, fzy
, curl
, texliveFull
}:
stdenv.mkDerivation rec {
pname = "archutils";
version = "1.01";
src = ./archutils;
nativeBuildInputs = [ makeWrapper ];
buildInputs = [
bash
feh
jq
curl
fzy
texliveFull
];
installPhase = ''
mkdir -p $out/bin
for i in $(ls $src/); do
cp $src/$i $out/bin
ln -sf $out/bin/tmenu_run $out/bin/regenerate
wrapProgram $out/bin/$i --prefix PATH : ${lib.makeBinPath [ bash feh jq curl fzy texliveFull ]}
done
'';
}

View File

@ -0,0 +1,90 @@
#!/bin/sh
working_directory=$(date +%Y-%m-%d)
human_readable=$(date "+%d %b %Y")
cd ~/doc/briefs/
mkdir "$working_directory"
cd "$working_directory"
cat > main.tex <<EOF
\documentclass[oneside]{article}
\usepackage{amssymb}
\pagenumbering{gobble}
\begin{document}
\noindent {\Large Ryan Marina} \hspace{\fill} {\Large Briefing for $human_readable}
\noindent \textsc{Internal Document System} \hspace{\fill} $ \square $ \textit{scanned?} $ \square $ \textit{not scanned?}
\noindent \textit{Digital Archive Supplement} \hspace{\fill} internal notes: \rule{3cm}{0.4pt}
\noindent \texttt{iref:doc/briefs/$working_directory}
\vspace{0.4cm}
\noindent \textsc{Schedule}
\vspace{-0.30cm}
\noindent \rule{12cm}{0.4pt}
EOF
schedule=$(
khal list today today --format "{categories}|{start-time}|{end-time}|{title}" |
grep '^school|'
)
IFS='
'
for class in $schedule; do
echo "$class" |
awk -F'|' '{
print "\\noindent " $4 " \\hspace{\\fill} \\textit{(" $2 "-" $3 ")}\n\n"
}' >> main.tex
done
cat >> main.tex <<EOF
\vspace{0.4cm}
\noindent \textsc{Unresolved Items}
\vspace{-0.30cm}
\noindent \rule{12cm}{0.4pt}
EOF
todo_items=$(
todo --porcelain |
jq -r '.[].summary'
)
IFS='
'
for todo in $todo_items; do
printf '\\noindent $ \\square $ %s\n\n' "$todo" >> main.tex
done
cat >> main.tex <<EOF
\vspace{0.4cm}
\noindent \textsc{Items to be Appended to the Agenda}
\vspace{-0.30cm}
\noindent \rule{12cm}{0.4pt}
\end{document}
EOF
pdflatex main.tex
printf "[!] briefing generated\n"
printf "file:///home/usr/doc/briefs/%s/main.pdf\n" "$working_directory"