add uebungen latex scaffolding

This commit is contained in:
2025-11-18 02:09:44 +01:00
parent a2bc018235
commit a81c7fceb6
8 changed files with 344 additions and 1 deletions

110
flake.nix Normal file
View File

@@ -0,0 +1,110 @@
{
description = "Description for the project";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = inputs @ {flake-parts, ...}:
flake-parts.lib.mkFlake {inherit inputs;} {
imports = [
# To import an internal flake module: ./other.nix
# To import an external flake module:
# 1. Add foo to inputs
# 2. Add foo as a parameter to the outputs function
# 3. Add here: foo.flakeModule
];
systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"];
perSystem = {
config,
self',
inputs',
pkgs,
system,
...
}:
with pkgs.lib; let
latexPackages = with pkgs; [
latexrun
(texlive.withPackages
(ps:
with ps; [
amsmath
biber
biblatex
changepage
csquotes
enumitem
fontaxes
latexmk
listings
minted
newtx
newtxsf
newtxtt
scheme-medium
textpos
times
titlesec
transparent
upquote
]))
];
in {
# Per-system attributes can be defined here. The self' and inputs'
# module parameters provide easy access to attributes of the same
# system.
packages = with pkgs; let
fmtNum = strings.fixedWidthNumber 2;
fmtReleaseName = sem: author: chap: "${fmtNum sem} - ${fmtNum chap} - ${author.lastName}, ${author.firstName}.pdf";
fmtRelease = fmtReleaseName 3 {
firstName = "Linus";
lastName = "Nagel";
};
mkUebungPdf = n: args:
stdenvNoCC.mkDerivation rec {
name = fmtRelease n;
version = "1.0.0";
src = ./.;
buildInputs = latexPackages;
buildPhase =
# sh
''
cd docs/uebungen
latexmk \
-pdf \
-l -dir-report -file-line-error -verbose \
-interaction=nonstopmode \
"uebung-${toString n}.tex"
'';
installPhase =
# sh
''
mkdir -p $out/share $out/log $out/artifacts
cp out/uebung-${toString n}.pdf "$out/share/${name}"
cp out/*.log $out/log/
cp out/* $out/artifacts
'';
}
// args;
in {
"uebung-5" = mkUebungPdf 5 {};
};
devShells.default = with pkgs;
mkShell {
nativeBuildInputs = [];
packages = [mermaid-cli] ++ latexPackages;
shellHook = ''
'';
};
};
flake = {
# The usual flake attributes can be defined here, including system-
# agnostic ones like nixosModule and system-enumerating ones, although
# those are more easily expressed in perSystem.
};
};
}