summaryrefslogtreecommitdiff
path: root/flake.nix
blob: a79574b91c32c7a29d4a01bcc02c1af6c18bff50 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{
  description = "My CV";
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs";
    nix-filter.url = "github:numtide/nix-filter";
    latex-utils = {
      url = "github:jmmaloney4/latex-utils";
      inputs = {
        flake-parts.follows = "flake-parts";
        systems.follows = "systems";
      };
    };
    files.url = "github:mightyiam/files";
    flake-parts.url = "github:hercules-ci/flake-parts";
    systems.url = "github:nix-systems/default";
  };

  outputs = inputs@{ self, flake-parts, latex-utils, ... }: flake-parts.lib.mkFlake { inherit self inputs; } {
    systems = import inputs.systems;

    imports = [
      latex-utils.modules.flake.latex-utils
      inputs.files.flakeModules.default
    ];

    latex-utils = {
      documents = [
        {
          name = "cv.pdf";
          src = ./.;
          inputFile = "cv.tex";
        }
      ];
    };


    perSystem = { config, pkgs, ... }: {
      devShells.default = pkgs.mkShellNoCC {
        inputsFrom = [
          config.devShells.latex-utils
        ];
        nativeBuildInputs = [
          config.files.writer.drv
        ];
      };

      files.files = [
        {
          path_ = ".latexmkrc";
          drv = pkgs.writeText ".latexmkrc" /* perl */ ''
            $out_dir = './build';
            $pdf_mode = 1;
            $pdflatex = 'pdflatex -shell-escape -interaction=nonstopmode %O %S';
          '';
        }
      ];
    };
  };
}