diff options
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 32 |
1 files changed, 22 insertions, 10 deletions
@@ -8,15 +8,13 @@ | |||
8 | url = "github:hercules-ci/gitignore"; | 8 | url = "github:hercules-ci/gitignore"; |
9 | flake = false; | 9 | flake = false; |
10 | }; | 10 | }; |
11 | flake-compat = { | ||
12 | url = "github:edolstra/flake-compat"; | ||
13 | flake = false; | ||
14 | }; | ||
15 | }; | 11 | }; |
16 | 12 | ||
17 | outputs = { self, nixpkgs, utils, gitignore, ... }: | 13 | outputs = { self, nixpkgs, utils, gitignore, ... }: |
18 | utils.lib.eachDefaultSystem (system: | 14 | utils.lib.eachDefaultSystem (system: |
19 | let | 15 | let |
16 | pname = "report"; | ||
17 | version = "0.1.0"; | ||
20 | pkgs = nixpkgs.legacyPackages."${system}"; | 18 | pkgs = nixpkgs.legacyPackages."${system}"; |
21 | inherit (import gitignore { inherit (pkgs) lib; }) gitignoreSource; | 19 | inherit (import gitignore { inherit (pkgs) lib; }) gitignoreSource; |
22 | nativeBuildInputs = with pkgs; [ | 20 | nativeBuildInputs = with pkgs; [ |
@@ -32,24 +30,38 @@ | |||
32 | }) | 30 | }) |
33 | gnumake | 31 | gnumake |
34 | ]; | 32 | ]; |
33 | watcher = pkgs.writeScriptBin "watch" '' | ||
34 | out=".latexmkout" | ||
35 | mkdir "$out" | ||
36 | latexmk \ | ||
37 | -pvc \ | ||
38 | -outdir="$out" \ | ||
39 | -pdf \ | ||
40 | -pdflatex="pdflatex -interaction=nonstopmode" \ | ||
41 | -use-make ${pname}.tex | ||
42 | rm -r "$out" | ||
43 | ''; | ||
35 | in | 44 | in |
36 | rec { | 45 | rec { |
37 | defaultPackage = stdenv.mkDerivation { | 46 | defaultPackage = pkgs.stdenv.mkDerivation { |
38 | pname = "report"; | 47 | inherit pname version; |
39 | version = "0.1.0"; | ||
40 | src = gitignoreSource ./.; | 48 | src = gitignoreSource ./.; |
41 | buildInputs = nativeBuildInputs; | 49 | buildInputs = nativeBuildInputs; |
42 | buildPhase = '' | 50 | buildPhase = '' |
43 | latexmk -pdf \ | 51 | latexmk \ |
52 | -pdf \ | ||
44 | -pdflatex="pdflatex -interaction=nonstopmode" \ | 53 | -pdflatex="pdflatex -interaction=nonstopmode" \ |
45 | -use-make | 54 | -use-make ${pname}.tex |
46 | ${pname}.tex | ||
47 | ''; | 55 | ''; |
48 | installPhase = '' | 56 | installPhase = '' |
49 | mkdir -p $out | 57 | mkdir -p $out |
50 | cp ${pname}.pdf $out/ | 58 | cp ${pname}.pdf $out/ |
51 | ''; | 59 | ''; |
52 | }; | 60 | }; |
61 | apps.watch = { | ||
62 | type = "app"; | ||
63 | program = "${watcher}/bin/watch"; | ||
64 | }; | ||
53 | devShell = pkgs.mkShell { | 65 | devShell = pkgs.mkShell { |
54 | nativeBuildInputs = nativeBuildInputs; | 66 | nativeBuildInputs = nativeBuildInputs; |
55 | }; | 67 | }; |