From b4c550e429259920752a544242df14f3fa1b4760 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Mon, 8 Jan 2024 17:55:55 +0100 Subject: [PATCH 1/5] add .envrc file for direnv When the user shell has support for direnv, it automatically opens a nix-shell. This saves one manual "$ nix-shell" step. --- .envrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 .envrc diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..1d953f4 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use nix From 892aa6de95ed9d5e65b2ed792a0c951df8474150 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Mon, 8 Jan 2024 17:59:03 +0100 Subject: [PATCH 2/5] niv: update nixpkgs This bumps the nixpkgs version. --- nix/sources.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/nix/sources.json b/nix/sources.json index f78cfcf..96525b3 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -5,22 +5,22 @@ "homepage": "", "owner": "hercules-ci", "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", - "sha256": "07vg2i9va38zbld9abs9lzqblz193vc5wvqd6h7amkmwf66ljcgh", + "rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5", + "sha256": "1rlja3ba9s1n0icy3aarwhx9hk1jyfgngzizbn1afwwdlpvdlqw0", "type": "tarball", - "url": "https://github.com/hercules-ci/gitignore.nix/archive/a20de23b925fd8264fd7fad6454652e142fd7f73.tar.gz", + "url": "https://github.com/hercules-ci/gitignore.nix/archive/43e1aa1308018f37118e34d3a9cb4f5e75dc11d5.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "nixpkgs": { - "branch": "release-22.11", + "branch": "release-23.11", "description": "Nix Packages collection", "homepage": "", "owner": "NixOS", "repo": "nixpkgs", - "rev": "62ffdb32823e8d8caca00d0d75ac8e02212de76b", - "sha256": "0nfz26f2lc75av8ijvavq3ajq6cqwmlkn62fcy76222v9hyhqdcy", + "rev": "6723fa4e4f1a30d42a633bef5eb01caeb281adc3", + "sha256": "16wshya4xpy5ipsjlcyy13qi01slma6825y5ihzq0c90g3y8l6h0", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/62ffdb32823e8d8caca00d0d75ac8e02212de76b.tar.gz", + "url": "https://github.com/NixOS/nixpkgs/archive/6723fa4e4f1a30d42a633bef5eb01caeb281adc3.tar.gz", "url_template": "https://github.com///archive/.tar.gz" } } From df3456853fe3d6f208f25827d335652ae5f8f1f3 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Mon, 8 Jan 2024 18:06:29 +0100 Subject: [PATCH 3/5] Makefile: actually use ANSI escape sequences --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index a6ecb8a..257818f 100644 --- a/Makefile +++ b/Makefile @@ -80,8 +80,8 @@ CMD_COUNT_PAGES = pdfinfo $(DOC_PDF) | awk '/^Pages:/ {print $$2}' CMD_COUNT_WORDS = pdftotext $(DOC_PDF) $(DOC_PDF:.pdf=.pdf.txt) && cat $(DOC_PDF:.pdf=.pdf.txt) | grep -E '^\.+\ *$$' -v | wc -w stats: pdf - $(QUIET)echo "\e[1mThesis Stats:\e[0m" - $(QUIET)echo " \e[1mdetexed sources and removed empty lines:\e[0m" + $(QUIET)echo -e "\e[1mThesis Stats:\e[0m" + $(QUIET)echo -e " \e[1mdetexed sources and removed empty lines:\e[0m" $(QUIET)echo " lines: $(shell detex $(DOC_TEX_ALL_SORTED) | sed '/^$$/d' | wc -l)" $(QUIET)echo " words: $(shell detex $(DOC_TEX_ALL_SORTED) | sed '/^$$/d' | wc -w)" $(QUIET)echo " characters: $(shell detex $(DOC_TEX_ALL_SORTED) | sed '/^$$/d' | wc --chars)" @@ -90,6 +90,6 @@ stats: pdf $(QUIET)echo " version might contain additional words, such as 'in Figure 3.5 on the" $(QUIET)echo " next page' or the bibliography." $(QUIET)echo - $(QUIET)echo " \e[1mCompiled PDF:\e[0m" + $(QUIET)echo -e " \e[1mCompiled PDF:\e[0m" $(QUIET)echo " pages: $(shell $(CMD_COUNT_PAGES)) (in total)" $(QUIET)echo " words: $(shell $(CMD_COUNT_WORDS)) (roughly)" From 7efd2dfc8b310c2600c5d4671f7844106283cf85 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Mon, 8 Jan 2024 18:06:51 +0100 Subject: [PATCH 4/5] nix: toolchain: add detex --- nix/tex-toolchain.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/tex-toolchain.nix b/nix/tex-toolchain.nix index fa2ad79..4b55b21 100644 --- a/nix/tex-toolchain.nix +++ b/nix/tex-toolchain.nix @@ -5,6 +5,7 @@ texlive.combine { biber biblatex csquotes + detex # Only for Makefile convenience scripts; not for the actual build hyphenat lastpage latexmk From 593ee60d70bd35307c5421c710e028a99787f18a Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Mon, 8 Jan 2024 18:12:20 +0100 Subject: [PATCH 5/5] github: modernize and format CI file --- .editorconfig | 3 ++ .github/workflows/build.yml | 99 +++++++++++++++++++++---------------- 2 files changed, 59 insertions(+), 43 deletions(-) diff --git a/.editorconfig b/.editorconfig index a630245..aeafdb6 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,5 +13,8 @@ trim_trailing_whitespace = true [Makefile] indent_style = tab +[*.yml] +indent_size = 2 + [*.tex] max_line_length = 100 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fecfcbb..d00f177 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,48 +1,61 @@ name: "Build" on: - pull_request: - push: + pull_request: + push: + merge_group: + jobs: - # uses nix - nix_build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2.3.4 - - uses: cachix/install-nix-action@v17 - - run: nix-build - # -s: test if this is a file and if it has a size. - - run: test -s result/diplom.pdf + # Builds the Nix derivation. + nix_build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v24 + - uses: DeterminateSystems/magic-nix-cache-action@main + - run: nix-build + # -s: test if this is a file and if it has a size. + - run: test -s result/diplom.pdf + + # Tests the regular build but with a toolchain from the Nix shell. + nix_shell: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v24 + - uses: DeterminateSystems/magic-nix-cache-action@main + - run: nix-shell --run "make" + - run: nix-shell --run "make stats" - # uses latexmk - regular_build: - runs-on: ubuntu-latest - steps: - - name: Set up Git repository - uses: actions/checkout@v2 - - name: Compile LaTeX document - uses: xu-cheng/latex-action@v2 - with: - # options listed here: - # https://github.com/xu-cheng/latex-action - root_file: diplom.tex - latexmk_use_lualatex: true - # required when using the "minted" package for beautiful styled code - # latexmk_shell_escape: true + # Builds with a regular toolchain via latexmk. + regular_build: + runs-on: ubuntu-latest + steps: + - name: Set up Git repository + uses: actions/checkout@v4 + - name: Compile LaTeX document + uses: xu-cheng/latex-action@v2 + with: + # options listed here: + # https://github.com/xu-cheng/latex-action + root_file: diplom.tex + latexmk_use_lualatex: true + # required when using the "minted" package for beautiful styled code + # latexmk_shell_escape: true - # checkbiw and check-french-spacing must execute without error - check_scripts: - runs-on: ubuntu-latest - steps: - - name: Set up Git repository - uses: actions/checkout@v2 - # additionally: check out submodules - with: - submodules: recursive - - name: install make - run: sudo apt update && sudo apt install make - - name: make check-french-spacing - run: make check-french-spacing - - name: install diction - run: sudo apt update && sudo apt install diction - - name: make checkbiw - run: make checkbiw + # checkbiw and check-french-spacing must execute without error + check_scripts: + runs-on: ubuntu-latest + steps: + - name: Set up Git repository + uses: actions/checkout@v4 + # additionally: check out submodules + with: + submodules: recursive + - name: install make + run: sudo apt update && sudo apt install make + - name: make check-french-spacing + run: make check-french-spacing + - name: install diction + run: sudo apt update && sudo apt install diction + - name: make checkbiw + run: make checkbiw