initial commit

This commit is contained in:
Tim Schubert 2022-11-01 13:50:29 +01:00
commit f1b9082f4e
Signed by: dadada
GPG key ID: EEB8D1CE62C4DFEA
15 changed files with 498 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
result

16
LICENSE Normal file
View file

@ -0,0 +1,16 @@
MIT No Attribution
Copyright 2023 Tim Schubert
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

3
README.md Normal file
View file

@ -0,0 +1,3 @@
# tubslatex-nix
Unofficial Nix package and project templates for [tubslatex](https://www.tu-braunschweig.de/latex-vorlagen), the corporate design of TU Braunschweig.

39
flake.lock generated Normal file
View file

@ -0,0 +1,39 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1667077288,
"narHash": "sha256-bdC8sFNDpT0HK74u9fUkpbf1MEzVYJ+ka7NXCdgBoaA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "6ee9ebb6b1ee695d2cacc4faa053a7b9baa76817",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 0,
"narHash": "sha256-3nD7iQXd/J6KjkT8IjozTuA5p8qjiLKTxvOUmH+AzNM=",
"path": "/nix/store/ig0dn500x8lm7mjq8sp3s2k1hpji0xxj-source",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

53
flake.nix Normal file
View file

@ -0,0 +1,53 @@
{
description = "tubslatex";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, flake-utils, nixpkgs }@inputs:
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
};
in
{
packages = rec {
default = tubslatex;
tubslatex = pkgs.tubslatex;
};
checks = {
format = pkgs.runCommand "format" { buildInputs = [ pkgs.nixpkgs-fmt ]; } "nixpkgs-fmt --check ${./.} && touch $out";
testOverlay = pkgs.mkShell {
buildInputs = [ pkgs.texliveWithTubslatex ];
shellHook = ''Shell created'';
};
};
formatter = pkgs.nixpkgs-fmt;
}) // {
overlays.default = final: prev: {
tubslatex = prev.callPackage ./tubslatex.nix { };
texliveWithTubslatex =
let
postCombineOverride = oldAttrs: {
postBuild = oldAttrs.postBuild + ''
updmap --sys --enable Map=NexusProSerif.map --enable Map=NexusProSans.map
updmap --sys
'';
};
tubslatexAttrs = { pkgs = [ final.tubslatex ]; };
combined = prev.texlive.combine {
inherit (prev.texlive) scheme-full;
inherit tubslatexAttrs;
};
in
combined.overrideAttrs postCombineOverride;
};
};
}

2
template/.envrc Normal file
View file

@ -0,0 +1,2 @@
watch_file devshell.toml
use flake

22
template/.gitignore vendored Normal file
View file

@ -0,0 +1,22 @@
*.swp
.direnv/
*.aux
*.fdb_latexmk
*.fls
*.log
*.bbl
*.bcf
*.blg
*.out
*.run.xml
*.dvi
*.ps
*.glsdefs
*.lof
*.toc
*.bak
*.nav
*.snm
*.vrb
*.pyg
thesis.pdf

15
template/Makefile Normal file
View file

@ -0,0 +1,15 @@
.PHONY: thesis.pdf all watch clean
all: thesis.pdf
clean:
latexmk -C thesis.tex
thesis.pdf: thesis.tex
latexmk -interaction=batchmode -pdf thesis.tex
watch:
while true; do \
inotifywait -qr -e modify -e create -e delete -e move *tex; \
$(MAKE); \
done

View file

@ -0,0 +1,8 @@
@article{lisa,
author = {Lisa Mueller},
title = {Example: Why this article does not exist},
journal = {Super popular journal},
volume = {3},
number = {1},
year = {2020}
}

46
template/devshell.toml Normal file
View file

@ -0,0 +1,46 @@
imports = [ "git/hooks" ]
packages = [ "texliveWithTubslatex", "inotify-tools" ]
[devshell]
name = "thesis"
[[commands]]
name = "format"
command = "nix fmt"
help = "Formats the nix files"
category = "development"
[[commands]]
name = "update"
command = "nix flake update --commit-lock-file"
help = "Updates the dependencies"
category = "development"
[[commands]]
name = "check"
command = "nix flake check"
help = "Checks if this flake is valid"
category = "development"
[[commands]]
name = "build-thesis"
command = "make thesis.pdf"
category = "outputs"
help = "Builds the thesis"
[[commands]]
name = "clean"
command = "make clean"
category = "outputs"
help = "Cleans the build directory"
[git.hooks]
enable = true
[git.hooks.pre-commit]
text = """
FILES=$(git diff --cached --name-only --diff-filter=ACMR -- *.nix| sed -e 's| |\\ |g')
[ -z "$FILES" ] && exit 0
echo $FILES | xargs nix fmt
echo $FILES | xargs git add
exit 0"""

156
template/flake.lock generated Normal file
View file

@ -0,0 +1,156 @@
{
"nodes": {
"devshell": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1678957337,
"narHash": "sha256-Gw4nVbuKRdTwPngeOZQOzH/IFowmz4LryMPDiJN/ah4=",
"owner": "numtide",
"repo": "devshell",
"rev": "3e0e60ab37cd0bf7ab59888f5c32499d851edb47",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1642700792,
"narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "846b2ae0fc4cc943637d3d1def4454213e203cba",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_3": {
"locked": {
"lastModified": 1667077288,
"narHash": "sha256-bdC8sFNDpT0HK74u9fUkpbf1MEzVYJ+ka7NXCdgBoaA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "6ee9ebb6b1ee695d2cacc4faa053a7b9baa76817",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1677383253,
"narHash": "sha256-UfpzWfSxkfXHnb4boXZNaKsAcUrZT9Hw+tao1oZxd08=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9952d6bc395f5841262b006fbace8dd7e143b634",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1681269223,
"narHash": "sha256-i6OeI2f7qGvmLfD07l1Az5iBL+bFeP0RHixisWtpUGo=",
"path": "/nix/store/dnj69agbi6dz7985gvcbmv40wk1skvmy-source",
"rev": "87edbd74246ccdfa64503f334ed86fa04010bab9",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 0,
"narHash": "sha256-3nD7iQXd/J6KjkT8IjozTuA5p8qjiLKTxvOUmH+AzNM=",
"path": "/nix/store/ig0dn500x8lm7mjq8sp3s2k1hpji0xxj-source",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"devshell": "devshell",
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2",
"tubslatex": "tubslatex"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"tubslatex": {
"inputs": {
"flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1667307103,
"narHash": "sha256-lwS0/ON7yc8I+orxt7w+zO0Dmo1peQ65z4ObKaJhAdk=",
"ref": "refs/heads/main",
"rev": "cae35e5ff56a43f446f175a3931c5b468354bb00",
"revCount": 1,
"type": "git",
"url": "ssh://github.com/dadada/tubslatex-nix?branch=main"
},
"original": {
"type": "git",
"url": "ssh://github.com/dadada/tubslatex-nix?branch=main"
}
}
},
"root": "root",
"version": 7
}

58
template/flake.nix Normal file
View file

@ -0,0 +1,58 @@
{
description = "Thesis";
inputs.flake-utils.url = github:numtide/flake-utils;
inputs.devshell.url = github:numtide/devshell;
inputs.tubslatex.url = "git+ssh://github.com/dadada/tubslatex-nix?branch=main";
outputs = { self, flake-utils, nixpkgs, devshell, tubslatex }@inputs:
flake-utils.lib.eachDefaultSystem
(system:
let
tubslatexOverlay = tubslatex.overlays.default;
pkgs = import nixpkgs {
inherit system;
overlays = [ tubslatexOverlay ];
};
in
{
devShells.default =
let
pkgs = import nixpkgs {
inherit system;
overlays = [
devshell.overlay
tubslatexOverlay
];
};
in
pkgs.devshell.mkShell {
imports = [ (pkgs.devshell.importTOML ./devshell.toml) ];
};
checks = {
format = pkgs.runCommand "format" { buildInputs = [ pkgs.nixpkgs-fmt ]; } "nixpkgs-fmt --check ${./.} && touch $out";
};
formatter = pkgs.nixpkgs-fmt;
packages.default = pkgs.callPackage
({ lib, texliveWithTubslatex, stdenvNoCC, ... }: stdenvNoCC.mkDerivation {
pname = "thesis";
version = "0.1";
src = ./.;
nativeBuildInputs = [ texliveWithTubslatex ];
dontConfigure = true;
installPhase = ''
mkdir -p $out
cp thesis.pdf $out
'';
meta = with lib; {
description = "Master thesis proposal";
maintainers = [ "dadada" ];
platforms = platforms.all;
license = licenses.proprietary;
};
})
{ };
});
}

28
template/thesis.tex Normal file
View file

@ -0,0 +1,28 @@
\documentclass[german=false,thesistype=bachelor,nolistoftables,noabstract]{tubsthesis}
\usepackage{lipsum}
\input{thesisconfig.tex}
\addbibresource{bibliography.bib}
\thesisinstitute{Institute of Perfect Writing in IT}
\begin{document}
\thesisabstract{%
% Since `noabstract` is set, this abstract won't be printed
This is an english text.\\
\lipsum[1-2]
}
\begin{thesis}
\chapter{Introduction}
\lipsum[1-3]
\end{thesis}
\chapter{Storage Device}
Put a table of the contents of your attached Storage Device (SD card/USB flash drive) here.
Add explanations where needed!
\end{document}

11
template/thesisconfig.tex Normal file
View file

@ -0,0 +1,11 @@
\thesisname{Johanna Doe}
\thesismatrikel{1234567}
\thesisemail{j.doe@tu-braunschweig.de}
\thesismajor{Informatik}
\thesisduration{3}
\thesissupervisors{Super Visor, M. Sc.}{Dr. Dipper Visor}{}
\thesisprofessor[Prof.\,Dr.-Ing.\,Jane Smith]{Prof.\,Dr.-Ing.\,Lars Eisbär}
\thesistitle{Titel der Thesis}{Title of the thesis}
\thesisbegindate{2020-01-01}
%\thesisenddate{2020-01-02}
\thesispresentationpoints{5.7}

40
tubslatex.nix Normal file
View file

@ -0,0 +1,40 @@
{ lib
, stdenvNoCC
, texlive
, unzip
, requireFile
, ...
}:
let
pname = "tubslatex";
version = "1.3.4";
tubslatexDownload = requireFile {
name = "${pname}_${version}.tds.zip";
sha256 = "18adp73l1iqn050ivzjmnp6rgpihkl1278x4ip93xjpicd7mrnlv";
url = "https://www.tu-braunschweig.de/latex-vorlagen";
};
in
stdenvNoCC.mkDerivation {
inherit version pname;
src = tubslatexDownload;
passthru.tlType = "run";
nativeBuildInputs = [ unzip texlive.combined.scheme-small ];
dontConfigure = true;
unpackPhase = ''
runHook preUnpack
unzip "$src"
runHook postUnpack
'';
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r * $out/
runHook postInstall
'';
meta = with lib; {
description = "TU Braunschweig Corporate Design";
maintainers = [ "dadada" ];
platforms = platforms.all;
license = licenses.unfree;
};
}