Add tex module
This commit is contained in:
parent
2fff6aa766
commit
666261a731
4 changed files with 77 additions and 9 deletions
|
|
@ -19,6 +19,7 @@
|
|||
../../modules/dictionary.nix
|
||||
../../modules/yt-dlp.nix
|
||||
../../modules/claude-code.nix
|
||||
../../modules/tex.nix
|
||||
../../config/fonts.nix
|
||||
];
|
||||
|
||||
|
|
@ -184,7 +185,6 @@
|
|||
hidden-bar # Menu bar organizer (macOS-only)
|
||||
|
||||
# Development and build tools
|
||||
texlive.combined.scheme-full
|
||||
python312
|
||||
uv
|
||||
lazysql
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
imports = [
|
||||
../home-default.nix
|
||||
../../../modules/syncthing.nix
|
||||
../../../modules/tex.nix
|
||||
];
|
||||
|
||||
# hs-specific home configuration
|
||||
|
|
@ -30,7 +31,6 @@
|
|||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
texlive.combined.scheme-full
|
||||
];
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
../../../modules/plasma.nix
|
||||
../../../modules/syncthing.nix
|
||||
../../../modules/ghostty.nix
|
||||
../../../modules/tex.nix
|
||||
plasma-manager.homeModules.plasma-manager
|
||||
];
|
||||
|
||||
|
|
@ -32,7 +33,6 @@
|
|||
# For example, laptop-specific aliases or scripts
|
||||
|
||||
home.packages = with pkgs; [
|
||||
texlive.combined.scheme-full
|
||||
keepassxc
|
||||
obsidian
|
||||
];
|
||||
|
|
|
|||
68
modules/tex.nix
Normal file
68
modules/tex.nix
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
# Install TeXLive
|
||||
home.packages = with pkgs; [
|
||||
texlive.combined.scheme-full
|
||||
];
|
||||
|
||||
# Shell aliases for LaTeX compilation
|
||||
programs.zsh.shellAliases = {
|
||||
# Clean auxiliary LaTeX files
|
||||
mkpdf-clean = "latexmk -C";
|
||||
};
|
||||
|
||||
# Shell functions for LaTeX compilation
|
||||
programs.zsh.initContent = ''
|
||||
# Build PDF with latexmk
|
||||
# Usage: mkpdf [file.tex]
|
||||
# If no argument provided, builds all .tex files in current directory
|
||||
function mkpdf() {
|
||||
local tex_file="''${1}"
|
||||
local output_dir="./out"
|
||||
|
||||
if [[ -z "$tex_file" ]]; then
|
||||
# Build all .tex files in current directory
|
||||
local tex_files=(*.tex)
|
||||
if [[ ''${#tex_files[@]} -eq 0 ]] || [[ ! -f "''${tex_files[0]}" ]]; then
|
||||
echo "No .tex files found in current directory"
|
||||
return 1
|
||||
fi
|
||||
|
||||
for file in "''${tex_files[@]}"; do
|
||||
echo "Building $file..."
|
||||
latexmk -pdf -bibtex -shell-escape -interaction=nonstopmode \
|
||||
-output-directory="$output_dir" -f "$file"
|
||||
done
|
||||
else
|
||||
if [[ ! -f "$tex_file" ]]; then
|
||||
echo "File not found: $tex_file"
|
||||
return 1
|
||||
fi
|
||||
|
||||
latexmk -pdf -bibtex -shell-escape -interaction=nonstopmode \
|
||||
-output-directory="$output_dir" -f "$tex_file"
|
||||
fi
|
||||
}
|
||||
|
||||
# Continuous compilation mode - watch and auto-rebuild
|
||||
# Usage: mkpdf-watch <file.tex>
|
||||
function mkpdf-watch() {
|
||||
local tex_file="''${1}"
|
||||
local output_dir="./out"
|
||||
|
||||
if [[ -z "$tex_file" ]]; then
|
||||
echo "Usage: mkpdf-watch <file.tex>"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "$tex_file" ]]; then
|
||||
echo "File not found: $tex_file"
|
||||
return 1
|
||||
fi
|
||||
|
||||
latexmk -pdf -pvc -view=none -shell-escape -interaction=nonstopmode \
|
||||
-output-directory="$output_dir" -f "$tex_file"
|
||||
}
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue