From 0b4930574b249176b4ec00e852fa5bea23de99e2 Mon Sep 17 00:00:00 2001 From: Pedro Rey Anca Date: Sun, 7 Sep 2025 23:59:47 +0200 Subject: [PATCH] Add package to flake --- .gitignore | 4 ++++ flake.nix | 59 +++++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 54 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 78957ad..e570fbe 100644 --- a/.gitignore +++ b/.gitignore @@ -320,3 +320,7 @@ TSWLatexianTemp* ### lualatex ### luatex.*/ + +### Nix ### +result +result/ \ No newline at end of file diff --git a/flake.nix b/flake.nix index ad93015..04de325 100644 --- a/flake.nix +++ b/flake.nix @@ -1,19 +1,60 @@ { -description = "LaTeX Beamer Presentation for GPUL Schools: Software Libre"; + description = "LaTeX Beamer Presentation for GPUL Schools: Software Libre"; inputs = { nixpkgs.url = github:NixOS/nixpkgs/nixos-25.05; flake-utils.url = github:numtide/flake-utils; }; - outputs = { self, nixpkgs, flake-utils }: - flake-utils.lib.eachDefaultSystem (system: - let pkgs = nixpkgs.legacyPackages.${system}; in - { + outputs = { + self, + nixpkgs, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem ( + system: let + pkgs = nixpkgs.legacyPackages.${system}; + tex = pkgs.texlive.combine { + inherit + (pkgs.texlive) + scheme-basic + latex-bin + latexmk + collection-langspanish + beamer + biblatex + biber + csquotes + emoji + fontspec + noto-emoji + ; + }; + # tex = pkgs.texliveFull; + in rec { + packages = { + document = pkgs.stdenvNoCC.mkDerivation rec { + name = "latex-beamer-gpul-schools-software-libre"; + src = self; + buildInputs = [pkgs.coreutils tex]; + phases = ["unpackPhase" "buildPhase" "installPhase"]; + buildPhase = '' + export PATH="${pkgs.lib.makeBinPath buildInputs}"; + env TEXMFVAR=$(mktemp -d) \ + SOURCE_DATE_EPOCH=${toString self.lastModified} \ + latexmk -interaction=nonstopmode -pdf -lualatex \ + -pretex="\pdfvariable suppressoptionalinfo 512\relax" \ + -usepretex main.tex + ''; + installPhase = '' + mkdir -p $out + cp main.pdf $out/ + ''; + }; + }; + defaultPackage = packages.document; + devShells.default = pkgs.mkShell { - buildInputs = with pkgs; [ - texstudio - texlive.combined.scheme-full - ]; + buildInputs = packages.document.buildInputs; }; } );