summaryrefslogtreecommitdiff
path: root/default.nix
blob: 6385c9dee2fb031d9bb9dfce2d30ce567e5ee9d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{ pkgs, latex, data }:

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);

  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" { } ''
      mkdir -p "$out" && cd $_
      ln -sT ${cv-tex} cv.tex
      ln -sT ${files} files
      ln -sT ${noto-fonts-emoji}/share/fonts/noto fonts
    '') { };
in {
  src = source;
  pdf = pkgs.callPackage ({ cv-src ? source, texlive }:
    pkgs.runCommand "cv.pdf" {
      buildInputs = [ texlive.combined.moderncv ];
    } ''
      export HOME=$(pwd)
      latexmk -pdflua -cd "${cv-src}"/cv.tex --output-directory=$(pwd)
      mv cv.pdf "$out"
    '') { };
}