Hello there.
Say that i have a tex package: source/example.sty
\NeedsTeXFormat{LaTeX2e}
\ProvidePackage{example}{today -- some example}
\newcommand\helloWorld{Hello World!}
I figured i could package it like this (not sure if its the right way to do it):
pkgs:
pkgs.stdenv.mkDerivation {
name = "example";
src = ./source;
installPhase = ''
mkdir -p $out/tex/latex
cp -r $src/example.sty $out/tex/latex
'';
passthru.tlType = "run";
}
Finally i want to create a devShell that includes this package and exposes it to texlive to be used, something in the lines:
pkgs:
let
example = import example.nix {pkgs};
in
pkgs.mkShell { buildInputs = [example]; };
So far the only way i could have this package being added to my config is recreating texlive the following way:
pkgs:
let
example = import example.nix {pkgs}; texlive = pkgs.texlive.combine {
pkgFilter = pkg: with pkg; tlType == "run" || tlType == "bin" || tlType == "doc";
example.pkgs = [ example ];
inherit (pkgs.texlive) scheme-basic;
};
in
pkgs.mkShell { buildInputs = [ texlive ]; };
This raises a problem that i would like that my texlive installation to be modular instead of having to build everything every time i change the exaple package. Also being able to use my current texlive package is a bonus, evicting building a whole texlive to add a single package.
Edit: Rewritting question.