aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wells <chris@mathematicaster.org>2026-02-27 17:09:14 -0600
committerChris Wells <chris@mathematicaster.org>2026-02-27 17:09:14 -0600
commit58453dd110fa970d0176cb7cab1af5332f095ce7 (patch)
treed43c6e854bfa50fd5b6421b87cc1616281ca4944
parent9a1ce9bd883f540d1626fb7b25a36d734bc1be53 (diff)
downloadtex-shell-master.tar
tex-shell-master.tar.gz
tex-shell-master.tar.bz2
tex-shell-master.tar.lz
tex-shell-master.tar.xz
tex-shell-master.tar.zst
tex-shell-master.zip
Added a default latexmkrcHEADmaster
-rw-r--r--LICENSE20
-rw-r--r--README.md7
-rw-r--r--module.nix28
-rw-r--r--template/flake.nix9
4 files changed, 53 insertions, 11 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..2287adf
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2026 Chris Wells
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..a1d64c7
--- /dev/null
+++ b/README.md
@@ -0,0 +1,7 @@
+# tex-shell
+
+A [flake-parts](https://flake.parts/) module for building a devShell equipped with LaTeX.
+For a significantly more sophisticated implementation, see [latex-utils](https://github.com/jmmaloney4/latex-utils).
+
+The point of this simple flake-parts module is to give you a devShell with texlive along with a `latexmk` wrapped with a `.latexmkrc` file.
+My use case is to get a texlive environment that works for interacting with a repo with a bunch of latex documents, e.g. class notes, homeworks and exams.
diff --git a/module.nix b/module.nix
index 0aa7fff..c385bea 100644
--- a/module.nix
+++ b/module.nix
@@ -3,7 +3,6 @@ let
inherit (lib)
mkIf
mkOption
- mkPackageOption
mkEnableOption
types
;
@@ -15,10 +14,25 @@ in
{
options = {
texShell = {
- scheme = mkPackageOption pkgs "texliveSmall" { };
+ scheme = mkOption {
+ type = types.packages;
+ default = pkgs.texliveSmall;
+ description = ''
+ The base texlive scheme to use. Choose between:
+ - pkgs.texliveSmall
+ - pkgs.texliveMedium
+ - pkgs.texliveFull
+ - pkgs.texliveBasic
+ - pkgs.texliveMinimal
+ - pkgs.texliveTeTex
+ '';
+ };
extraPackages = mkOption {
type = types.functionTo (types.listOf types.package);
- description = "Extra packages to add to the texlive scheme";
+ description = ''
+ Extra packages to add to the texlive scheme.
+ Unlike more sophisticated projects such as [latex-utils](https://github.com/jmmaloney4/latex-utils), there is no auto-discovery of necessary packages.
+ '';
default = _: [ ];
};
latexmk = {
@@ -26,6 +40,11 @@ in
rc = mkOption {
type = types.lines;
description = "contents of the .latexmkrc file";
+ default = /* perl */ ''
+ $out_dir = '.latex-build';
+ $pdf_mode = 1;
+ $pdflatex = 'lualatex -interaction=nonstopmode -file-line-error -synctex=1 %O %S';
+ '';
};
rcFile = mkOption {
type = types.path;
@@ -36,6 +55,7 @@ in
type = types.functionTo types.package;
readOnly = true;
internal = true;
+ description = "A wrapper derivation to add the rc file to latexmk";
default =
tex:
pkgs.symlinkJoin {
@@ -52,6 +72,7 @@ in
package = mkOption {
type = types.package;
readOnly = true;
+ description = "The final texlive package";
default =
let
wrapper = if config.texShell.latexmk.enable then config.texShell.latexmk._wrapper else x: x;
@@ -61,6 +82,7 @@ in
devShell = mkOption {
type = types.package;
readOnly = true;
+ description = "The final texlive shell";
default = pkgs.mkShellNoCC { buildInputs = [ config.texShell.build.package ]; };
};
};
diff --git a/template/flake.nix b/template/flake.nix
index 59878c1..aa8e775 100644
--- a/template/flake.nix
+++ b/template/flake.nix
@@ -21,14 +21,7 @@
texShell = {
scheme = pkgs.texliveSmall;
- latexmk = {
- enable = true;
- rc = /* perl */ ''
- $out_dir = '.latex-build';
- $pdf_mode = 1;
- $pdflatex = 'pdflatex -interaction=nonstopmode %O %S';
- '';
- };
+ latexmk.enable = true;
};
devShells.default = pkgs.mkShellNoCC { inputsFrom = [ config.texShell.build.devShell ]; };