feat: add files

This commit is contained in:
Max Koon
2025-08-06 10:50:11 -04:00
parent c5cbf7307e
commit edb28680e6
4 changed files with 484 additions and 0 deletions

283
flake.nix Normal file
View File

@@ -0,0 +1,283 @@
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
outputs = { self, nixpkgs }:
let
resume = import ./resume.nix;
vspace = "-8pt";
escapeLatex = s: builtins.replaceStrings
[ "\\" "{" "}" "$" "&" "%" "#" "_" "~" "^" ]
[ "\\textbackslash{}" "\\{" "\\}" "\\$" "\\&" "\\%" "\\#" "\\_" "\\textasciitilde{}" "\\textasciicircum{}" ]
s;
mkPersonal = personal:
''
\begin{tabular*}{\textwidth}{l@{\extracolsep{\fill}}r}
\textbf{\href{https://${personal.website}}{\Large ${personal.name}}} & \href{https://${personal.website}}{${personal.website}}\\
\href{mailto:${personal.email}}{${personal.email}} & \href{https://${personal.github}}{${personal.github}}\\
\end{tabular*}
'';
mkItem = item:
''
\item\small{
{${item}}
}
'';
mkSectionChild = child:
''
\vspace{-2pt}\item
\begin{tabular*}{0.97\textwidth}[t]{l@{\extracolsep{\fill}}r}
\textbf{${child.heading}} & ${child.location} \\
\textit{\small\parbox[t]{0.7\textwidth}{${(builtins.head child.children).subheading}}} & \textit{\small ${(builtins.head child.children).dates}} \\
\end{tabular*}\vspace{${vspace}}
\begin{itemize}
${builtins.concatStringsSep "\n" (map mkItem (builtins.head child.children).items)}
\end{itemize}\vspace{${vspace}}
${if builtins.length child.children > 1
then builtins.concatStringsSep "\n" (map (child: ''
\begin{tabular*}{0.97\textwidth}{l@{\extracolsep{\fill}}r}
\textit{\small ${child.subheading}} & \textit{\small ${child.dates}} \\
\end{tabular*}\vspace{${vspace}}
\begin{itemize}
${builtins.concatStringsSep "\n" (map mkItem child.items)}
\end{itemize}\vspace{${vspace}}
'') (builtins.tail child.children))
else ""}
'';
mkSection = section:
''
\section{${section.label}}
\begin{itemize}[leftmargin=*]
${builtins.concatStringsSep "\n" (map mkSectionChild section.children)}
\end{itemize}
'';
mkEducation = edu:
mkSection {
label = "Education";
children = map (item: {
heading = item.school;
location = item.location;
children = [
{
subheading = item.degree;
dates = item.dates;
items = [
(nixpkgs.lib.strings.concatStrings ["Involvement: " (builtins.concatStringsSep ", " item.organizations)])
];
}
];
}
) edu;
};
mkExperience = experience:
mkSection {
label = "Experience";
children = map (item: {
heading = item.company;
location = item.location;
children = map (role: {
subheading = role.title;
dates = role.dates;
items = (nixpkgs.lib.splitString "\n" (nixpkgs.lib.trim (escapeLatex role.work)));
}) item.roles;
}
) experience;
};
mkProjects = projects:
mkSection {
label = "Projects";
children = map (item: {
heading = item.name;
location = item.link;
children = [
{
subheading = item.subtext;
dates = item.dates;
items = (nixpkgs.lib.splitString "\n" (nixpkgs.lib.trim (escapeLatex item.description)));
}
];
}
) projects;
};
mkLeadership = leadership:
mkSection {
label = "Leadership Experience";
children = map (item: {
heading = item.name;
location = item.location;
children = [
{
subheading = item.role;
dates = item.dates;
items = (nixpkgs.lib.splitString "\n" (nixpkgs.lib.trim (escapeLatex item.description)));
}
];
}
) leadership;
};
mkAwards = awards:
mkSection {
label = "Honors and Awards";
children = map (item: {
heading = item.name;
location = item.location;
children = [
{
subheading = item.award;
dates = item.dates;
items = (nixpkgs.lib.splitString "\n" (nixpkgs.lib.trim (escapeLatex item.description)));
}
];
}
) awards;
};
mkSkills = skills:
''
\section{Skills and Interests}
\begin{itemize}[leftmargin=*]
${builtins.concatStringsSep "\n" (nixpkgs.lib.mapAttrsToList (key: val: ''
\item\small{
{\textbf{${key}} \vspace{-2pt}}
}{${val}}\vspace{-4pt}
'') skills)}
\end{itemize}
'';
texContent = ''
%-------------------------
% Resume in LateX
% Author : Max Koon
% License : MIT
%------------------------
\documentclass[letterpaper,11pt]{article}
\usepackage{latexsym}
\usepackage[empty]{fullpage}
\usepackage{titlesec}
\usepackage{marvosym}
\usepackage[usenames,dvipsnames]{color}
\usepackage{verbatim}
\usepackage{enumitem}
\usepackage[hidelinks]{hyperref}
\usepackage{fancyhdr}
\usepackage[english]{babel}
\usepackage{tabularx}
\input{glyphtounicode}
\usepackage{bookmark}
\pagestyle{fancy}
\fancyhf{} % Clear all header and footer fields
\fancyfoot{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
% Adjust margins
\addtolength{\oddsidemargin}{-0.5in}
\addtolength{\evensidemargin}{-0.5in}
\addtolength{\textwidth}{1in}
\addtolength{\topmargin}{-.5in}
\addtolength{\textheight}{1.0in}
\urlstyle{same}
\raggedbottom
\raggedright
\setlength{\tabcolsep}{0in}
% Sections formatting
\titleformat{\section}{
\vspace{-4pt}\scshape\raggedright\large
}{}{0em}{}[\color{black}\titlerule \vspace{-5pt}]
% Ensure that generate PDF is machine readable/ATS parsable
\pdfgentounicode=1
%-------------------------
\newcommand{\resumeSubItem}[2]{
}
\renewcommand{\labelitemii}{$\circ$}
%-------------------------------------------
%%%%%% CV STARTS HERE %%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
${mkPersonal resume.personal}
${if resume.education.enabled
then mkEducation resume.education.content
else ""}
${if resume.experience.enabled
then mkExperience resume.experience.content
else ""}
${if resume.projects.enabled
then mkProjects resume.projects.content
else ""}
${if resume.leadership.enabled
then mkLeadership resume.leadership.content
else ""}
${if resume.awards.enabled
then mkAwards resume.awards.content
else ""}
${if resume.skills.enabled
then mkSkills resume.skills.content
else ""}
%-------------------------------------------
\end{document}
'';
in {
defaultPackage.aarch64-linux =
with import nixpkgs { system = "aarch64-linux"; };
stdenv.mkDerivation {
name = "resume";
src = self;
nativeBuildInputs = [
texliveFull
];
buildPhase = ''
cat > resume.tex << 'EOF'
${texContent}
EOF
pdflatex resume.tex
'';
installPhase = ''
mkdir -p $out
cp resume.pdf $out/
'';
};
};
}