diff options
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..525ebc6 --- /dev/null +++ b/flake.nix | |||
@@ -0,0 +1,57 @@ | |||
1 | { | ||
2 | description = "Latex Project Report Template"; | ||
3 | |||
4 | inputs = { | ||
5 | nixpkgs.url = "github:nixos/nixpkgs"; | ||
6 | utils.url = "github:numtide/flake-utils"; | ||
7 | gitignore = { | ||
8 | url = "github:hercules-ci/gitignore"; | ||
9 | flake = false; | ||
10 | }; | ||
11 | flake-compat = { | ||
12 | url = "github:edolstra/flake-compat"; | ||
13 | flake = false; | ||
14 | }; | ||
15 | }; | ||
16 | |||
17 | outputs = { self, nixpkgs, utils, gitignore, ... }: | ||
18 | utils.lib.eachDefaultSystem (system: | ||
19 | let | ||
20 | pkgs = nixpkgs.legacyPackages."${system}"; | ||
21 | inherit (import gitignore { inherit (pkgs) lib; }) gitignoreSource; | ||
22 | nativeBuildInputs = with pkgs; [ | ||
23 | (texlive.combine { | ||
24 | inherit (texlive) | ||
25 | scheme-medium | ||
26 | multirow | ||
27 | hyperref | ||
28 | blindtext | ||
29 | fancyhdr | ||
30 | etoolbox | ||
31 | topiclongtable; | ||
32 | }) | ||
33 | gnumake | ||
34 | ]; | ||
35 | in | ||
36 | rec { | ||
37 | defaultPackage = stdenv.mkDerivation { | ||
38 | pname = "report"; | ||
39 | version = "0.1.0"; | ||
40 | src = gitignoreSource ./.; | ||
41 | buildInputs = nativeBuildInputs; | ||
42 | buildPhase = '' | ||
43 | latexmk -pdf \ | ||
44 | -pdflatex="pdflatex -interaction=nonstopmode" \ | ||
45 | -use-make | ||
46 | ${pname}.tex | ||
47 | ''; | ||
48 | installPhase = '' | ||
49 | mkdir -p $out | ||
50 | cp ${pname}.pdf $out/ | ||
51 | ''; | ||
52 | }; | ||
53 | devShell = pkgs.mkShell { | ||
54 | nativeBuildInputs = nativeBuildInputs; | ||
55 | }; | ||
56 | }); | ||
57 | } | ||