aboutsummaryrefslogtreecommitdiffstats
path: root/build/latex/letter
diff options
context:
space:
mode:
Diffstat (limited to 'build/latex/letter')
-rwxr-xr-xbuild/latex/letter/build.sh30
-rw-r--r--build/latex/letter/flake.nix28
2 files changed, 50 insertions, 8 deletions
diff --git a/build/latex/letter/build.sh b/build/latex/letter/build.sh
index 1206ee7..c67ad52 100755
--- a/build/latex/letter/build.sh
+++ b/build/latex/letter/build.sh
@@ -1,14 +1,30 @@
#!/usr/bin/env sh
-# if no parameter is given, use 'dst' as destination directory
-if [ -z "$1" ]; then
- dst=build
-else
- dst="$1"
-fi
+file="./%INIT_APPLICATION_NAME.tex"
+dst=build
+
+clear=false
+
+for arg in "$@"; do
+ case "$arg" in
+ "--clear")
+ clear=true
+ ;;
+ --*)
+ echo "No such option: '$arg'"
+ exit 2
+ ;;
+ *)
+ file="$arg"
+ ;;
+ esac
+done
# find all directories which are not the destination dir or inside it
find . -type d -not -name "$dst" -not -path "./$dst/*" -printf '%P\n' | while IFS= read -r dir; do
mkdir --parents "$dst/$dir"
done
-latexmk -outdir="$dst" -file-line-error -pdflatex -recorder "./%INIT_APPLICATION_NAME.tex"
+
+test "$clear" = true && rm "$dst/${file%tex}out"
+
+latexmk -outdir="$dst" -file-line-error -pdflatex -recorder "$file"
diff --git a/build/latex/letter/flake.nix b/build/latex/letter/flake.nix
index 4847a9c..6a21c68 100644
--- a/build/latex/letter/flake.nix
+++ b/build/latex/letter/flake.nix
@@ -18,6 +18,17 @@
flake-utils.follows = "flake-utils";
};
};
+ lpm = {
+ url = "git+https://codeberg.org/bpeetz/lpm.git";
+ inputs = {
+ nixpkgs.follows = "nixpkgs";
+ flake-compat.follows = "flake-compat";
+ flake-utils.follows = "flake-utils";
+ rust-overlay.follows = "rust-overlay";
+ crane.follows = "crane";
+ systems.follows = "systems";
+ };
+ };
# inputs for following
systems = {
@@ -33,6 +44,19 @@
systems.follows = "systems";
};
};
+ crane = {
+ url = "github:ipetkov/crane";
+ inputs = {
+ nixpkgs.follows = "nixpkgs";
+ };
+ };
+ rust-overlay = {
+ url = "github:oxalica/rust-overlay";
+ inputs = {
+ nixpkgs.follows = "nixpkgs";
+ flake-utils.follows = "flake-utils";
+ };
+ };
};
outputs = {
@@ -40,6 +64,7 @@
nixpkgs,
flake-utils,
treefmt-nix,
+ lpm,
flake_version_update,
...
}:
@@ -73,7 +98,7 @@
'';
installPhase = ''
- install -D ./build/main.pdf "$out/%INIT_APPLICATION_NAME.pdf";
+ install -D "./build/%INIT_APPLICATION_NAME.pdf" "$out/%INIT_APPLICATION_NAME.pdf";
'';
};
in {
@@ -91,6 +116,7 @@
cocogitto
reuse
flake_version_update.packages."${system}".default
+ lpm.packages."${system}".default
texlive
zathura