summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraristote <quentin.aristote@irif.fr>2025-12-09 17:04:45 +0100
committeraristote <quentin.aristote@irif.fr>2025-12-09 17:04:45 +0100
commit76728c3faefa6791158824062401973762659fc2 (patch)
tree9a01d6ec239f39cd8cb7922b26b7931cc5a27032
parent142720d405ceec1d768a56b8c9273621ac967c4c (diff)
format
-rw-r--r--default.nix66
-rw-r--r--lib/default.nix5
-rw-r--r--lib/latex.nix137
-rw-r--r--src/default.nix41
-rw-r--r--src/education/default.nix40
-rw-r--r--src/experience/default.nix49
-rw-r--r--src/languages/default.nix30
-rw-r--r--src/research/default.nix16
8 files changed, 211 insertions, 173 deletions
diff --git a/default.nix b/default.nix
index 3fd7dd7..6bf384f 100644
--- a/default.nix
+++ b/default.nix
@@ -2,34 +2,37 @@
pkgs,
latex,
data,
-}: let
+}:
+let
commonArgs = {
inherit data latex make;
inherit (pkgs) lib;
};
- make = path: overrides: let
- f = import path;
- in
- f ((builtins.intersectAttrs (builtins.functionArgs f) commonArgs)
- // overrides);
+ make =
+ path: overrides:
+ let
+ f = import path;
+ in
+ f ((builtins.intersectAttrs (builtins.functionArgs f) commonArgs) // overrides);
- cvTEX = builtins.toFile "cv.tex" (make ./src {});
- source = pkgs.callPackage ({
- noto-fonts-emoji,
- # Source files
- cv-tex ? cvTEX,
- files ? data.files,
- }:
- pkgs.runCommand "cv-src" {} ''
+ cvTEX = builtins.toFile "cv.tex" (make ./src { });
+ source = pkgs.callPackage (
+ {
+ noto-fonts-color-emoji,
+ # Source files
+ cv-tex ? cvTEX,
+ files ? data.files,
+ }:
+ pkgs.runCommand "cv-src" { } ''
mkdir -p "$out" && cd $_
ln -sT ${cv-tex} cv.tex
ln -sT ${files} files
ln -sT ${noto-fonts-color-emoji}/share/fonts/noto fonts
- '') {};
+ ''
+ ) { };
latexDeps = tl: {
- inherit
- (tl)
+ inherit (tl)
scheme-basic
citation-style-language
latexmk
@@ -45,19 +48,24 @@
emoji
;
};
-in {
+in
+{
inherit latexDeps;
src = source;
- pdf = pkgs.callPackage ({
- cv-src ? source,
- texlive,
- }:
- pkgs.runCommand "cv.pdf" {
- buildInputs = [(texlive.combine (latexDeps texlive))];
- } ''
- export HOME=$(pwd)
- latexmk -pdflua -cd "${cv-src}"/cv.tex --output-directory=$(pwd)
- mv cv.pdf "$out"
- '') {};
+ pdf = pkgs.callPackage (
+ {
+ cv-src ? source,
+ texlive,
+ }:
+ pkgs.runCommand "cv.pdf"
+ {
+ buildInputs = [ (texlive.combine (latexDeps texlive)) ];
+ }
+ ''
+ export HOME=$(pwd)
+ latexmk -pdflua -cd "${cv-src}"/cv.tex --output-directory=$(pwd)
+ mv cv.pdf "$out"
+ ''
+ ) { };
}
diff --git a/lib/default.nix b/lib/default.nix
index 6926374..24267b1 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -1,3 +1,4 @@
-{lib}: {
- pp.latex = import ./latex.nix {inherit lib;};
+{ lib }:
+{
+ pp.latex = import ./latex.nix { inherit lib; };
}
diff --git a/lib/latex.nix b/lib/latex.nix
index 1524620..e3d0597 100644
--- a/lib/latex.nix
+++ b/lib/latex.nix
@@ -1,47 +1,42 @@
-{lib, ...}: let
- lines = content:
- if lib.isList content
- then
+{ lib, ... }:
+let
+ lines =
+ content:
+ if lib.isList content then
(
- if content == []
- then ""
- else lines (builtins.head content) + "\n" + lines (builtins.tail content)
+ if content == [ ] then "" else lines (builtins.head content) + "\n" + lines (builtins.tail content)
)
- else content;
+ else
+ content;
sortByFun = cmp: f: lib.sort (x: y: cmp (f x) (f y));
sortByPath = cmp: keys: sortByFun cmp (lib.getAttrFromPath keys);
- sortByKey = cmp: key: sortByPath cmp [key];
- for = iterable: f:
- if lib.isList iterable
- then builtins.map f iterable
- else lib.mapAttrsToList f iterable;
+ sortByKey = cmp: key: sortByPath cmp [ key ];
+ for =
+ iterable: f: if lib.isList iterable then builtins.map f iterable else lib.mapAttrsToList f iterable;
setOptionalArg = name: value: "${name}=${value}";
- expandArgsPrefixed = numArgs: prefix:
- if numArgs <= 0
- then prefix
+ expandArgsPrefixed =
+ numArgs: prefix:
+ if numArgs <= 0 then
+ prefix
else
- arg: let
+ arg:
+ let
appendToPrefix =
- if lib.isAttrs arg
- then
- "["
- + lib.concatStringsSep "," (lib.mapAttrsToList setOptionalArg arg)
- + "]"
- else "{${arg}}";
- newNumArgs =
- if lib.isAttrs arg
- then numArgs
- else numArgs - 1;
+ if lib.isAttrs arg then
+ "[" + lib.concatStringsSep "," (lib.mapAttrsToList setOptionalArg arg) + "]"
+ else
+ "{${arg}}";
+ newNumArgs = if lib.isAttrs arg then numArgs else numArgs - 1;
in
- expandArgsPrefixed newNumArgs (prefix + appendToPrefix);
+ expandArgsPrefixed newNumArgs (prefix + appendToPrefix);
macroWithOpts = name: numArgs: expandArgsPrefixed numArgs "\\${name}";
- macro = name: content: let
- contentExpanded =
- if lib.isList content
- then lib.concatStringsSep "}{" content
- else content;
- in "\\${name}{${contentExpanded}}";
+ macro =
+ name: content:
+ let
+ contentExpanded = if lib.isList content then lib.concatStringsSep "}{" content else content;
+ in
+ "\\${name}{${contentExpanded}}";
sectionMacro = type: name: content: ''
\${type}{${name}}
@@ -72,7 +67,7 @@
email = macroWithOpts "email" 1;
extrainfo = macroWithOpts "extrainfo" 1;
photo = macroWithOpts "photo" 1;
- makecvtitle = macro "makecvtitle" [];
+ makecvtitle = macro "makecvtitle" [ ];
cventry = macroWithOpts "cventry" 6;
cvlistitem = macroWithOpts "cvlistitem" 1;
cvline = macroWithOpts "cvline" 2;
@@ -83,42 +78,52 @@
file = path: "files/${path}";
href = latex.href;
- timerange = startdate: enddate: let
- print = builtins.mapAttrs (_: x: builtins.toString x);
- # let str = builtins.toString x;
- # in if name == "year" then
- # builtins.substring 2 4 str
- # else
- # (if name == "month" && x < 10 then "0${str}" else str));
- start = print startdate;
- end = print enddate;
- months = {
- "1" = "jan";
- "2" = "feb";
- "3" = "mar";
- "4" = "apr";
- "5" = "may";
- "6" = "jun";
- "7" = "jul";
- "8" = "aug";
- "9" = "sep";
- "10" = "oct";
- "11" = "nov";
- "12" = "dec";
- };
- in
+ timerange =
+ startdate: enddate:
+ let
+ print = builtins.mapAttrs (_: x: builtins.toString x);
+ # let str = builtins.toString x;
+ # in if name == "year" then
+ # builtins.substring 2 4 str
+ # else
+ # (if name == "month" && x < 10 then "0${str}" else str));
+ start = print startdate;
+ end = print enddate;
+ months = {
+ "1" = "jan";
+ "2" = "feb";
+ "3" = "mar";
+ "4" = "apr";
+ "5" = "may";
+ "6" = "jun";
+ "7" = "jul";
+ "8" = "aug";
+ "9" = "sep";
+ "10" = "oct";
+ "11" = "nov";
+ "12" = "dec";
+ };
+ in
"${months."${start.month}"}."
+ lib.optionalString (start.year != end.year) " ${start.year}"
+ " -- ${months."${end.month}"}. ${end.year}";
in
- latex
- // {
- inherit for file href lines timerange;
- code = x: x;
- sort = let
+latex
+// {
+ inherit
+ for
+ file
+ href
+ lines
+ timerange
+ ;
+ code = x: x;
+ sort =
+ let
lt = x: y: x < y;
gt = x: y: x > y;
- in {
+ in
+ {
byKey = sortByKey lt;
byPath = sortByPath lt;
byFun = sortByFun lt;
@@ -128,4 +133,4 @@ in
byFun = sortByFun gt;
};
};
- }
+}
diff --git a/src/default.nix b/src/default.nix
index e698a93..dbc9fca 100644
--- a/src/default.nix
+++ b/src/default.nix
@@ -4,24 +4,25 @@
make,
...
}:
-with latex; let
- sections = sort.byKey "priority" (make ./sections.nix {});
+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))
- ])
- ]
+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
index 2d46730..8d373f8 100644
--- a/src/education/default.nix
+++ b/src/education/default.nix
@@ -3,26 +3,32 @@
data,
lib,
...
-}: let
+}:
+let
education = data.education;
- sortByStartDate =
- latex.sort.reverse.byFun
- (x: with x.date.start; day + 100 * month + 10000 * year);
-in {
+ 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:
+ 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:
+ [
+ (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}}")));
+ 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
index cf4dc5f..cf025bb 100644
--- a/src/experience/default.nix
+++ b/src/experience/default.nix
@@ -3,29 +3,38 @@
data,
lib,
...
-}: let
+}:
+let
experience = data.experience.jobs;
-in {
+in
+{
title = "Experience";
priority = 0;
- content = with latex;
- for
- (sort.reverse.byFun (x: with x.date.start; day + 100 * month + 10000 * year)
- experience) (item:
+ 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
+ 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 == "Writings") assets)
- (lib.getAttr "id"))))));
+ + 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 == "Writings") assets) (lib.getAttr "id")
+ )
+ )
+ )
+ )
+ );
}
diff --git a/src/languages/default.nix b/src/languages/default.nix
index 9853c32..b00efc6 100644
--- a/src/languages/default.nix
+++ b/src/languages/default.nix
@@ -3,24 +3,28 @@
data,
lib,
...
-}: let
+}:
+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 {
+ 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);
+ content =
+ with latex;
+ for (sortByProficiency languages) (
+ lang: with lang; moderncv.cvline "${name} \\emoji{${icon.shortcode}}" proficiency
+ );
}
diff --git a/src/research/default.nix b/src/research/default.nix
index aa53634..db70f5a 100644
--- a/src/research/default.nix
+++ b/src/research/default.nix
@@ -1,22 +1,26 @@
{
- latex,
data,
- lib,
...
-}: let
+}:
+let
addBibResource = name: ''
\begin{filecontents*}{${name}.json}
${builtins.toJSON data.research."${name}"}
\end{filecontents*}
\addbibresource{${name}.json}
- '';
-in {
+ '';
+in
+{
title = "Research";
priority = 30;
extraHeader = ''
\usepackage[style=ieee]{citation-style-language}
\cslsetup{bib-item-sep = 8 pt plus 4 pt minus 2 pt}
- '' + addBibResource "conferences" + addBibResource "journals" + addBibResource "misc" + addBibResource "reports";
+ ''
+ + addBibResource "conferences"
+ + addBibResource "journals"
+ + addBibResource "misc"
+ + addBibResource "reports";
content = ''
\nocite{*}