diff options
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..23b96bd --- /dev/null +++ b/flake.nix @@ -0,0 +1,54 @@ +# Taken from https://flyx.org/nix-flakes-latex/ +{ + description = "LaTeX Document Demo"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + nixvim.url = "github:nix-community/nixvim"; + }; + outputs = { + self, + nixpkgs, + nixvim, + flake-utils, + }: + with flake-utils.lib; + eachSystem allSystems (system: let + pkgs = nixpkgs.legacyPackages.${system}; + tex = pkgs.texlive.combine { + inherit (pkgs.texlive) scheme-basic cite pgf nicematrix latex-bin latexmk titlesec listings ieeetran; + }; + nvim = nixvim.legacyPackages.x86_64-linux.makeNixvim { + plugins.lsp.enable = true; + colorschemes.gruvbox.enable = true; + }; + in rec { + packages = { + document = pkgs.stdenvNoCC.mkDerivation rec { + name = "latex-demo-document"; + src = self; + buildInputs = [ pkgs.coreutils pkgs.texliveFull pkgs.pandoc pkgs.texliveFull pkgs.tetex pkgs.zathura pkgs.kile]; + phases = ["unpackPhase" "buildPhase" "installPhase"]; + buildPhase = '' + runHook preBuild + + export PATH="${pkgs.lib.makeBinPath buildInputs}"; + #pandoc rpa.md -s -o rpa.tex --pdf-engine=pdflatex + mkdir -p .cache/texmf-var + env TEXMFHOME=.cache TEXMFVAR=.cache/texmf-var \ + latexmk -f -interaction=nonstopmode -pdf -pdflatex \ + main.tex + runHook postBuild + ''; + installPhase = '' + runHook preInstall + + install -m644 -D *.pdf $out/main.pdf + + runHook postInstall + ''; + }; + }; + defaultPackage = packages.document; + }); +} |