summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorquentin@aristote.fr <quentin@aristote.fr>2023-08-21 11:36:24 +0200
committerquentin@aristote.fr <quentin@aristote.fr>2023-08-21 17:44:49 +0200
commit731a43a83e2e2b61d11c5ac33fe96f92cef41bb5 (patch)
treeea32a6c6ae5c036cab7b390543f9cb71e9444095 /src
initial commit
Diffstat (limited to 'src')
-rw-r--r--src/default.nix22
-rw-r--r--src/education/default.nix21
-rw-r--r--src/experience/default.nix22
-rw-r--r--src/header.tex10
-rw-r--r--src/languages/default.nix22
-rw-r--r--src/publications/default.nix19
-rw-r--r--src/sections.nix15
7 files changed, 131 insertions, 0 deletions
diff --git a/src/default.nix b/src/default.nix
new file mode 100644
index 0000000..421367b
--- /dev/null
+++ b/src/default.nix
@@ -0,0 +1,22 @@
+{ latex, data, make, ... }:
+
+with latex;
+let sections = sort.byKey "priority" (make ./sections.nix { });
+in with data.basics;
+lines [
+ (builtins.readFile ./header.tex)
+ (comment "-------------------- EXTRA --------------------")
+ (for sections (section: section.extraHeader))
+ (comment "-------------------- DATA --------------------")
+ (moderncv.name name.first name.last)
+ (moderncv.email email.personal)
+ (moderncv.extrainfo (latex.url url))
+ (moderncv.photo { "" = "128pt"; } avatar)
+ ""
+ (document [
+ (title institution.position)
+ moderncv.makecvtitle
+ description
+ (for sections (section: section.content))
+ ])
+]
diff --git a/src/education/default.nix b/src/education/default.nix
new file mode 100644
index 0000000..5b79323
--- /dev/null
+++ b/src/education/default.nix
@@ -0,0 +1,21 @@
+{ latex, data, lib, ... }:
+
+let
+ education = data.education;
+ sortByStartDate = latex.sort.reverse.byFun
+ (x: with x.date.start; day + 100 * month + 10000 * year);
+in {
+ title = "Education";
+ priority = 10;
+ content = with latex;
+ for (sortByStartDate education) (item:
+ with item;
+ [
+ (moderncv.cventry (latex.timerange date.start date.end) studyType
+ (with institution; href url name) institution.location "" description)
+ ] ++ lib.optional (item ? "years") (for (sortByStartDate years) (year:
+ with year;
+ moderncv.cvlistitem "${with program; bold (href url acronym)} (${
+ timerange date.start date.end
+ }). ${program.studyType}. {\\small ${description}}")));
+}
diff --git a/src/experience/default.nix b/src/experience/default.nix
new file mode 100644
index 0000000..500fd9e
--- /dev/null
+++ b/src/experience/default.nix
@@ -0,0 +1,22 @@
+{ latex, data, lib, ... }:
+
+let experience = data.experience;
+in {
+ title = "Experience";
+ priority = 0;
+ content = with latex;
+ for
+ (sort.reverse.byFun (x: with x.date.start; day + 100 * month + 10000 * year)
+ experience) (item:
+ with item;
+ moderncv.cventry (latex.timerange date.start date.end)
+ institution.position (with institution; href url name)
+ institution.location (if item ? supervisors then
+ "supervised by " + lib.concatStringsSep " \\& "
+ (for supervisors (supervisor: with supervisor; href url name))
+ else
+ "") (description + lib.optionalString (item ? assets) (" " + cite
+ (lib.concatStringsSep ","
+ (for (lib.filter (asset: asset.type == "Publications") assets)
+ (lib.getAttr "id"))))));
+}
diff --git a/src/header.tex b/src/header.tex
new file mode 100644
index 0000000..487888d
--- /dev/null
+++ b/src/header.tex
@@ -0,0 +1,10 @@
+\documentclass[11pt, a4paper, sans, colorlinks = True, citecolor = blue,
+urlcolor = blue]{moderncv}
+
+% --------------------- STYLE --------------------
+\moderncvstyle{casual}
+\moderncvcolor{green}
+\nopagenumbers{}
+
+% -------------------- MARGINS --------------------
+\usepackage[scale=0.75]{geometry}
diff --git a/src/languages/default.nix b/src/languages/default.nix
new file mode 100644
index 0000000..d030818
--- /dev/null
+++ b/src/languages/default.nix
@@ -0,0 +1,22 @@
+{ latex, data, lib, ... }:
+
+let
+ languages = data.languages;
+ sortByProficiency = lib.sort (lang1: lang2:
+ let
+ prof1 = lang1.proficiency;
+ prof2 = lang2.proficiency;
+ in (prof2 == "basic") || (prof1 == "native")
+ || (prof2 == "intermediate" && prof1 == "fluent"));
+in {
+ title = "Languages";
+ priority = 20;
+ extraHeader = ''
+ \usepackage{emoji}
+ \setemojifont{NotoColorEmoji.ttf}[Path=./fonts/]
+ '';
+ content = with latex;
+ for (sortByProficiency languages) (lang:
+ with lang;
+ moderncv.cvline "${name} \\emoji{${icon.shortcode}}" proficiency);
+}
diff --git a/src/publications/default.nix b/src/publications/default.nix
new file mode 100644
index 0000000..1d6232e
--- /dev/null
+++ b/src/publications/default.nix
@@ -0,0 +1,19 @@
+{ latex, data, lib, ... }:
+
+let
+ publications = data.publications;
+ publicationsBIB = builtins.toFile "publications.bib" (latex.lines
+ (builtins.map (entry: entry.cite.biblatex)
+ (latex.sort.reverse.byPath [ "issued" "date-parts" ] publications)));
+in {
+ title = "Publications";
+ priority = 30;
+ extraHeader = ''
+ \usepackage[sorting=ydnt]{biblatex}
+ \addbibresource{${publicationsBIB}}
+ '';
+ content = ''
+ \nocite{*}
+ \printbibliography[heading=none]
+ '';
+}
diff --git a/src/sections.nix b/src/sections.nix
new file mode 100644
index 0000000..faed484
--- /dev/null
+++ b/src/sections.nix
@@ -0,0 +1,15 @@
+{ latex, make, ... }:
+
+let
+ sectionTemplate = section: {
+ inherit (section) title priority;
+ extraHeader = if section ? extraHeader then section.extraHeader else "";
+ content = latex.section section.title section.content;
+ };
+ makeSection = path: sectionTemplate (make path { });
+in builtins.map makeSection [
+ ./experience
+ ./education
+ ./languages
+ ./publications
+]