feat: able to build the constitution

This commit is contained in:
silver 2025-03-17 23:34:23 +00:00
parent 08eb9f6f81
commit 240b2ab9cf
Signed by: silver
GPG key ID: 36F93D61BAD3FD7D
4 changed files with 60 additions and 1 deletions

View file

@ -36,6 +36,16 @@
];
};
};
tex = pkgs.texlive.combine {
#scheme-full
inherit (pkgs.texlive) scheme-full latex-bin latexmk;
};
vars = [ "sender" "receiver" ];
texvars = toString
(pkgs.lib.imap1 (i: n: ''\def\${n}{${"$" + (toString i)}}'') vars);
in rec {
# `nix develop`
devShell = pkgs.mkShell {
@ -48,6 +58,25 @@
};
packages = {
# using https://flyx.org/nix-flakes-latex/ as a basic
constitution = pkgs.stdenvNoCC.mkDerivation rec {
name = "ul_computer-society_constitution";
src = self;
buildInputs = [ pkgs.coreutils tex ];
phases = ["unpackPhase" "buildPhase" "installPhase"];
buildPhase = ''
export PATH="${pkgs.lib.makeBinPath buildInputs}";
# have to do it 3 times to get teh table of contents working properly
pdflatex -file-line-error -interaction=nonstopmode -synctex=1 -output-format=pdf Resources/Documents/Constitution.tex || true
pdflatex -file-line-error -interaction=nonstopmode -synctex=1 -output-format=pdf Resources/Documents/Constitution.tex || true
pdflatex -file-line-error -interaction=nonstopmode -synctex=1 -output-format=pdf Resources/Documents/Constitution.tex || true
'';
installPhase = ''
mkdir -p $out
cp Constitution.pdf $out/
'';
};
handovers = pkgs.writeShellScriptBin "format_handovers" ''
export PATH=${pkgs.lib.makeBinPath [pkgs.wkhtmltopdf bfom.defaultPackage.x86_64-linux]}:$PATH
${./_scripts/format_handovers.sh}