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

@ -0,0 +1,29 @@
name: On_Push
on:
push:
# branches:
# - 'main'
paths:
- Resources/Documents/Constitution.tex
# so we can manually build the artifacts
workflow_dispatch:
jobs:
# rust code must be formatted for standardisation
pdfs:
# build it using teh base nixos system, helps with caching
runs-on: nix
permissions:
# needs this to create tags and releases
contents: write
steps:
# has to checkout first in order to be able to use the action
- uses: https://code.forgejo.org/actions/checkout@v4
- name: Use local action
uses: ./.forgejo/actions/build-release-pdf
with:
repository: ${{ gitea.repository }}
ref_name: ${{ gitea.ref_name }}
token: ${{ secrets.API_TOKEN_FORGEJO }}
script: "constitution"

1
.gitignore vendored
View file

@ -15,6 +15,7 @@ test.*
# Output of compiling
/out
/result
/build
/target
/cmake-build-debug

View file

@ -1,7 +1,7 @@
\documentclass{article}
\usepackage{graphicx}
% use the files
\graphicspath{ {../} }
\graphicspath{{Resources}{../}{./}}
\usepackage{hyperref}
% from https://tex.stackexchange.com/a/73866
\hypersetup{

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}