aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: 1072dcf4fc991f392668ac1c2796f6d109396a5f (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
60
61
62
63
64
65
66
67
68
# tex2nix

Generate Texlive environment containing all dependencies for your document
rather than downloading gigabytes of texlive packages.

## Installation

With stable nix you can do:

``` console
nix-build && ./result/bin/tex2nix
```

If you use flakes put the following in your inputs

```nix
{
  inputs.tex2nix.url = "github:Mic92/tex2nix";
  inputs.tex2nix.inputs.utils.follows = "nixpkgs";
}
```

or just do:

```console
$ nix run github:Mic92/tex2nix
```


## USAGE

```console
$ tex2nix main.tex
wrote tex-env.nix
$ cat tex-env.nix
# Generated with tex2nix 0.0.0
{ texlive }:
(texlive.combine {
    inherit (texlive) scheme-small;
    "varwidth" = texlive."varwidth";
    "tabu" = texlive."tabu";

})
```

tex2nix does not follow `\input` or `\include`. However you can specify multiple
texfiles as input

```console
$ tex2nix *.tex
```

The resulting expression can be imported like this to in your document directory:

```nix
# shell.nix
with import <nixpkgs> {};
mkShell {
  buildInputs = [ (pkgs.callPackage ./tex-env.nix {}) ];
}
```

``` console
$ nix-shell shell.nix
nix-shell> pdflatex --version
pdfTeX 3.14159265-2.6-1.40.21 (TeX Live 2020/NixOS.org)
...
```