From 6d0036785549254847ae8695e6c638f0e8fcfe64 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Sat, 21 Jan 2023 11:06:53 +0100 Subject: [PATCH 01/12] nix: niv: updated to stable nixpkgs 22.11 --- nix/build.nix | 1 + nix/sources.json | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/nix/build.nix b/nix/build.nix index 0f4a5f1..9ee6304 100644 --- a/nix/build.nix +++ b/nix/build.nix @@ -27,6 +27,7 @@ in stdenvNoCC.mkDerivation { # Avoid luatex failing due to non-writable cache. TEXMFVAR = "/tmp/texlive/"; + TEXTMFHOME = "/tmp/texlive/"; buildPhase = '' make diff --git a/nix/sources.json b/nix/sources.json index 6aeebae..f78cfcf 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -5,22 +5,22 @@ "homepage": "", "owner": "hercules-ci", "repo": "gitignore.nix", - "rev": "bff2832ec341cf30acb3a4d3e2e7f1f7b590116a", - "sha256": "0va0janxvmilm67nbl81gdbpppal4aprxzb25gp9pqvf76ahxsci", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "sha256": "07vg2i9va38zbld9abs9lzqblz193vc5wvqd6h7amkmwf66ljcgh", "type": "tarball", - "url": "https://github.com/hercules-ci/gitignore.nix/archive/bff2832ec341cf30acb3a4d3e2e7f1f7b590116a.tar.gz", + "url": "https://github.com/hercules-ci/gitignore.nix/archive/a20de23b925fd8264fd7fad6454652e142fd7f73.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "nixpkgs": { - "branch": "nixpkgs-unstable", + "branch": "release-22.11", "description": "Nix Packages collection", "homepage": "", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5643714dea562f0161529ab23058562afeff46d0", - "sha256": "1xs8h3jqi5fndy8b6x5i44a0l1qvbqwnsbs0is36fy6rwl8pdk8v", + "rev": "62ffdb32823e8d8caca00d0d75ac8e02212de76b", + "sha256": "0nfz26f2lc75av8ijvavq3ajq6cqwmlkn62fcy76222v9hyhqdcy", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/5643714dea562f0161529ab23058562afeff46d0.tar.gz", + "url": "https://github.com/NixOS/nixpkgs/archive/62ffdb32823e8d8caca00d0d75ac8e02212de76b.tar.gz", "url_template": "https://github.com///archive/.tar.gz" } } From 116c3f5bc532cde320b68d0d05e140f688d3da06 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Sat, 21 Jan 2023 11:17:05 +0100 Subject: [PATCH 02/12] nix: add shell.nix This commit introduces a nix-toolchain.nix, removes an unnecessary attribute in build.nix, and adds a shell.nix. --- default.nix | 1 + nix/build.nix | 17 ++--------------- nix/release.nix | 11 +++++------ nix/tex-toolchain.nix | 14 ++++++++++++++ shell.nix | 15 +++++++++++++++ 5 files changed, 37 insertions(+), 21 deletions(-) create mode 100644 default.nix create mode 100644 nix/tex-toolchain.nix create mode 100644 shell.nix diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..1263ad3 --- /dev/null +++ b/default.nix @@ -0,0 +1 @@ +import ./nix/release.nix diff --git a/nix/build.nix b/nix/build.nix index 9ee6304..43b6d68 100644 --- a/nix/build.nix +++ b/nix/build.nix @@ -1,19 +1,6 @@ -{ stdenvNoCC, gitignoreSource, texlive }: +{ stdenvNoCC, gitignoreSource, tex }: -let - tex = texlive.combine { - inherit (texlive) scheme-small - biber - biblatex - csquotes - hyphenat - lastpage - latexmk - siunitx - todonotes - xpatch; - }; -in stdenvNoCC.mkDerivation { +stdenvNoCC.mkDerivation { pname = "latex-template"; version = "1.0.0"; diff --git a/nix/release.nix b/nix/release.nix index 3aa2942..31b1c6c 100644 --- a/nix/release.nix +++ b/nix/release.nix @@ -1,11 +1,10 @@ let sources = import ./sources.nix; - pkgs = import sources.nixpkgs {}; - + pkgs = import sources.nixpkgs { }; + tex = import ./tex-toolchain.nix { inherit pkgs; }; inherit (import sources."gitignore.nix" { inherit (pkgs) lib; }) gitignoreSource; in -{ - latex-template = pkgs.callPackage ./build.nix { - inherit gitignoreSource; - }; +pkgs.callPackage ./build.nix { + inherit gitignoreSource; + inherit tex; } diff --git a/nix/tex-toolchain.nix b/nix/tex-toolchain.nix new file mode 100644 index 0000000..fa2ad79 --- /dev/null +++ b/nix/tex-toolchain.nix @@ -0,0 +1,14 @@ +{ pkgs }: +with pkgs; +texlive.combine { + inherit (texlive) scheme-small + biber + biblatex + csquotes + hyphenat + lastpage + latexmk + siunitx + todonotes + xpatch; +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..663834f --- /dev/null +++ b/shell.nix @@ -0,0 +1,15 @@ +{ pkgs ? import { } }: + +let + tex = import ./nix/tex-toolchain.nix { inherit pkgs; }; +in +pkgs.mkShell { + nativeBuildInputs = with pkgs; [ + gnumake + tex + + # convenience for working with nix files + niv + nixpkgs-fmt + ]; +} From b73d7cdc6444729427257df7837b3b632cf49c50 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Sat, 21 Jan 2023 11:18:32 +0100 Subject: [PATCH 03/12] nix: don't use unnecessary directory structure in result --- nix/build.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nix/build.nix b/nix/build.nix index 43b6d68..1fd2215 100644 --- a/nix/build.nix +++ b/nix/build.nix @@ -21,7 +21,7 @@ stdenvNoCC.mkDerivation { ''; installPhase = '' - mkdir -p $out/share/latex-template - install -m 0644 diplom.pdf $out/share/latex-template/ + mkdir -p $out + install -m 0644 diplom.pdf $out/ ''; } From ad74d40e5015d8f5ead003ae4f7e115b8a2ecec1 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Sat, 21 Jan 2023 11:18:07 +0100 Subject: [PATCH 04/12] nix: nixpkgs-fmt --- nix/sources.nix | 107 +++++++++++++++++++++++++----------------------- 1 file changed, 55 insertions(+), 52 deletions(-) diff --git a/nix/sources.nix b/nix/sources.nix index 9a01c8a..23ab29b 100644 --- a/nix/sources.nix +++ b/nix/sources.nix @@ -10,27 +10,27 @@ let let name' = sanitizeName name + "-src"; in - if spec.builtin or true then - builtins_fetchurl { inherit (spec) url sha256; name = name'; } - else - pkgs.fetchurl { inherit (spec) url sha256; name = name'; }; + if spec.builtin or true then + builtins_fetchurl { inherit (spec) url sha256; name = name'; } + else + pkgs.fetchurl { inherit (spec) url sha256; name = name'; }; fetch_tarball = pkgs: name: spec: let name' = sanitizeName name + "-src"; in - if spec.builtin or true then - builtins_fetchTarball { name = name'; inherit (spec) url sha256; } - else - pkgs.fetchzip { name = name'; inherit (spec) url sha256; }; + if spec.builtin or true then + builtins_fetchTarball { name = name'; inherit (spec) url sha256; } + else + pkgs.fetchzip { name = name'; inherit (spec) url sha256; }; fetch_git = name: spec: let ref = if spec ? ref then spec.ref else - if spec ? branch then "refs/heads/${spec.branch}" else - if spec ? tag then "refs/tags/${spec.tag}" else - abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!"; + if spec ? branch then "refs/heads/${spec.branch}" else + if spec ? tag then "refs/tags/${spec.tag}" else + abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!"; submodules = if spec ? submodules then spec.submodules else false; submoduleArg = let @@ -44,15 +44,15 @@ let + "but your nix's (${builtins.nixVersion}) builtins.fetchGit " + "does not support them" ) - {} - else {}; + { } + else { }; in - if nixSupportsSubmodules - then { inherit submodules; } - else emptyArgWithWarning; + if nixSupportsSubmodules + then { inherit submodules; } + else emptyArgWithWarning; in - builtins.fetchGit - ({ url = spec.repo; inherit (spec) rev; inherit ref; } // submoduleArg); + builtins.fetchGit + ({ url = spec.repo; inherit (spec) rev; inherit ref; } // submoduleArg); fetch_local = spec: spec.path; @@ -86,16 +86,16 @@ let hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath; hasThisAsNixpkgsPath = == ./.; in - if builtins.hasAttr "nixpkgs" sources - then sourcesNixpkgs - else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then - import {} - else - abort - '' - Please specify either (through -I or NIX_PATH=nixpkgs=...) or - add a package called "nixpkgs" to your sources.json. - ''; + if builtins.hasAttr "nixpkgs" sources + then sourcesNixpkgs + else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then + import { } + else + abort + '' + Please specify either (through -I or NIX_PATH=nixpkgs=...) or + add a package called "nixpkgs" to your sources.json. + ''; # The actual fetching function. fetch = pkgs: name: spec: @@ -118,10 +118,10 @@ let saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name; ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}"; in - if ersatz == "" then drv else - # this turns the string into an actual Nix path (for both absolute and - # relative paths) - if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}"; + if ersatz == "" then drv else + # this turns the string into an actual Nix path (for both absolute and + # relative paths) + if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}"; # Ports of functions for older nix versions @@ -132,7 +132,7 @@ let ); # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295 - range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1); + range = first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1); # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257 stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1)); @@ -143,43 +143,46 @@ let concatStrings = builtins.concatStringsSep ""; # https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331 - optionalAttrs = cond: as: if cond then as else {}; + optionalAttrs = cond: as: if cond then as else { }; # fetchTarball version that is compatible between all the versions of Nix builtins_fetchTarball = { url, name ? null, sha256 }@attrs: let inherit (builtins) lessThan nixVersion fetchTarball; in - if lessThan nixVersion "1.12" then - fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; })) - else - fetchTarball attrs; + if lessThan nixVersion "1.12" then + fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; })) + else + fetchTarball attrs; # fetchurl version that is compatible between all the versions of Nix builtins_fetchurl = { url, name ? null, sha256 }@attrs: let inherit (builtins) lessThan nixVersion fetchurl; in - if lessThan nixVersion "1.12" then - fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; })) - else - fetchurl attrs; + if lessThan nixVersion "1.12" then + fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; })) + else + fetchurl attrs; # Create the final "sources" from the config mkSources = config: - mapAttrs ( - name: spec: - if builtins.hasAttr "outPath" spec - then abort - "The values in sources.json should not have an 'outPath' attribute" - else - spec // { outPath = replace name (fetch config.pkgs name spec); } - ) config.sources; + mapAttrs + ( + name: spec: + if builtins.hasAttr "outPath" spec + then + abort + "The values in sources.json should not have an 'outPath' attribute" + else + spec // { outPath = replace name (fetch config.pkgs name spec); } + ) + config.sources; # The "config" used by the fetchers mkConfig = { sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null - , sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile) + , sources ? if isNull sourcesFile then { } else builtins.fromJSON (builtins.readFile sourcesFile) , system ? builtins.currentSystem , pkgs ? mkPkgs sources system }: rec { @@ -191,4 +194,4 @@ let }; in -mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); } +mkSources (mkConfig { }) // { __functor = _: settings: mkSources (mkConfig settings); } From c7a6d68d0af74fbe970a0b587f452b22bf887509 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Sat, 21 Jan 2023 11:23:21 +0100 Subject: [PATCH 05/12] ci: adapt --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1690b79..fecfcbb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,9 @@ jobs: steps: - uses: actions/checkout@v2.3.4 - uses: cachix/install-nix-action@v17 - - run: nix-build ./nix/release.nix -A latex-template + - run: nix-build + # -s: test if this is a file and if it has a size. + - run: test -s result/diplom.pdf # uses latexmk regular_build: From add5503e2db708646423b7cf21fdfa51cd4f94c6 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Sat, 21 Jan 2023 11:28:16 +0100 Subject: [PATCH 06/12] readme: switch to #-style headings --- README.md | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index bc21dd4..e04b0fc 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,14 @@ [![Build](https://github.com/TUD-OS/latex-template/actions/workflows/build.yml/badge.svg)](https://github.com/TUD-OS/latex-template/actions/workflows/build.yml) -Was ist das? -============ +## Was ist das? Dieses Diplomarbeits-Latex-Template stellt ein Skelett für eine Diplomarbeit mit zugehöriger Make-Datei zur Verfügung. -Checkout Submodules First -=================== +## Checkout Submodules First In order to use the `$ make checkbiw` script please execute: `git submodule update --init --recursive` -Build Prerequisites -=================== +## Build Prerequisites (Regular Build) In case you don't want to install `texlive-full` to save disk space, the following packages are actually required: \ ```shell @@ -37,8 +34,7 @@ $ sudo apt install \ latexmk ``` -So geht's los -============== +## So geht's los Als erstes solltest du in diplom.tex alle Vorkommen von Otto Mustermann, "Dein Titel" und "Dein Betreuer" ersetzen. @@ -57,15 +53,13 @@ Das Template unterstützt sowohl englischen und deutschen Text. Englisch ist standardmäßig eingestellt. Für deutschen Text kann der letzte `\selectlanguage` Aufruf in `diplom.tex` einfach weggelassen werden. -How To Build -============ +## How To Build - `make`: regular build - `make watch`: Performs a watch task, i.e. automatically re-builds everything quickly on changes. If your PDF viewer supports automatic reload on file changes (such as the default PDF viewer in GNOME) you get a cool productive working environment. -Grafiken einbinden -================== +## Grafiken einbinden Grafiken sollten im `images/` Verzeichnis abgelegt werden und im Makefile in die entsprechende `DOC_IMG_*` Variable eingetragen @@ -74,8 +68,7 @@ unterstützt. PDF eignet sich für Vektorgrafiken und kann von den meisten Vektorgrafikprogrammen erzeugt werden (Inkscape, OpenOffice Draw, ...). -Tipps -===== +## Tipps Diese Datei enthält im Moment ein Sammlung von Tipps und Tricks, sowie einige Hintergrundinformationen. @@ -115,8 +108,7 @@ einige Hintergrundinformationen. vim, ... make sure to activate the setting or add the plugin for that into your IDE/editor -spezielle Tipps von Frank -========================= +## spezielle Tipps von Frank - Ich verwende in der Vorlage KOMA-Script (`scrbook`), welches vor allem für den deutschsprachigen Raum gedacht ist. KOMA-Script kann auch From 22888ab01690df02362e79138d636ca873b04b1a Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Sat, 21 Jan 2023 11:32:21 +0100 Subject: [PATCH 07/12] readme: describe nix build --- README.md | 60 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index e04b0fc..14ef3c6 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,32 @@ Diplomarbeit mit zugehöriger Make-Datei zur Verfügung. ## Checkout Submodules First In order to use the `$ make checkbiw` script please execute: `git submodule update --init --recursive` -## Build Prerequisites (Regular Build) +## So geht's los + +Als erstes solltest du in diplom.tex alle Vorkommen von Otto +Mustermann, "Dein Titel" und "Dein Betreuer" ersetzen. + +`diplom.tex` will deine Aufgabe als PDF einbinden. Es sucht +`images/diplom-aufgabe.pdf`, was eine A4 Seite sein muss. Mit + + convert diplom-aufgabe.pdf + +solltest du eine beliebige Bilddatei in ein PDF umwandeln können, wenn +ImageMagick auf deinem System installiert ist. + +An diesen Punkt sollte `make` ein `diplom.pdf` produzieren. + +Das Template unterstützt sowohl englischen und deutschen Text. Englisch ist +standardmäßig eingestellt. Für deutschen Text kann der letzte `\selectlanguage` +Aufruf in `diplom.tex` einfach weggelassen werden. + +## How To Build +- `$ make`: regular build that produces `diplom.pdf` and `yyyy-mm-dd_hhmmss DRAFT Diplomarbeit - Branch .pdf`. +- `$ make watch`: Performs a watch task, i.e. automatically re-builds everything quickly on changes. + If your PDF viewer supports automatic reload on file changes (such as the default PDF viewer in GNOME) + you get a cool productive working environment. + +### Build Prerequisites (Regular Build) In case you don't want to install `texlive-full` to save disk space, the following packages are actually required: \ ```shell @@ -34,30 +59,15 @@ $ sudo apt install \ latexmk ``` -## So geht's los - -Als erstes solltest du in diplom.tex alle Vorkommen von Otto -Mustermann, "Dein Titel" und "Dein Betreuer" ersetzen. - -`diplom.tex` will deine Aufgabe als PDF einbinden. Es sucht -`images/diplom-aufgabe.pdf`, was eine A4 Seite sein muss. Mit - - convert diplom-aufgabe.pdf - -solltest du eine beliebige Bilddatei in ein PDF umwandeln können, wenn -ImageMagick auf deinem System installiert ist. - -An diesen Punkt sollte `make` ein `diplom.pdf` produzieren. - -Das Template unterstützt sowohl englischen und deutschen Text. Englisch ist -standardmäßig eingestellt. Für deutschen Text kann der letzte `\selectlanguage` -Aufruf in `diplom.tex` einfach weggelassen werden. - -## How To Build -- `make`: regular build -- `make watch`: Performs a watch task, i.e. automatically re-builds everything quickly on changes. - If your PDF viewer supports automatic reload on file changes (such as the default PDF viewer in GNOME) - you get a cool productive working environment. +### Build Prerequisites (Nix Build) +This template can also be built using [Nix](https://nixos.org/download.html). You have +the option to either use `$ nix-build`, which will produce `result/diplom.pdf`, or to +use +```bash +$ nix-shell +$ make clean +$ make watch # (or just make) +``` ## Grafiken einbinden From 7c2141009a8c8945f9ccc7da640f95cc1e756f8f Mon Sep 17 00:00:00 2001 From: Julian Stecklina Date: Sat, 21 Jan 2023 16:14:07 +0100 Subject: [PATCH 08/12] nix: don't rely on random channels of users For people with flakes systems, it is not a given that they have channels at all. --- shell.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shell.nix b/shell.nix index 663834f..917f633 100644 --- a/shell.nix +++ b/shell.nix @@ -1,4 +1,6 @@ -{ pkgs ? import { } }: +{ sources ? import ./nix/sources.nix +, pkgs ? import sources.nixpkgs { } +}: let tex = import ./nix/tex-toolchain.nix { inherit pkgs; }; From f5ca9e9d5b0a0ff469a7c209abd91548a46c59bb Mon Sep 17 00:00:00 2001 From: Julian Stecklina Date: Sat, 21 Jan 2023 16:17:32 +0100 Subject: [PATCH 09/12] nix: don't list build inputs twice Instead of listing build dependencies in shell.nix again, we can just inherit inputs from the build derivation. --- nix/release.nix | 5 +++-- shell.nix | 13 ++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/nix/release.nix b/nix/release.nix index 31b1c6c..d659204 100644 --- a/nix/release.nix +++ b/nix/release.nix @@ -1,6 +1,7 @@ +{ sources ? import ./sources.nix +, pkgs ? import sources.nixpkgs { } +}: let - sources = import ./sources.nix; - pkgs = import sources.nixpkgs { }; tex = import ./tex-toolchain.nix { inherit pkgs; }; inherit (import sources."gitignore.nix" { inherit (pkgs) lib; }) gitignoreSource; in diff --git a/shell.nix b/shell.nix index 917f633..1db8da2 100644 --- a/shell.nix +++ b/shell.nix @@ -1,17 +1,20 @@ { sources ? import ./nix/sources.nix , pkgs ? import sources.nixpkgs { } }: - let - tex = import ./nix/tex-toolchain.nix { inherit pkgs; }; + thisPackage = import ./nix/release.nix { + inherit sources; + inherit pkgs; + }; in pkgs.mkShell { nativeBuildInputs = with pkgs; [ - gnumake - tex - # convenience for working with nix files niv nixpkgs-fmt ]; + + inputsFrom = [ + thisPackage + ]; } From a9c84bf35ab0de2b7b1bd1fcac0703a40c97b623 Mon Sep 17 00:00:00 2001 From: Julian Stecklina Date: Sat, 21 Jan 2023 16:19:11 +0100 Subject: [PATCH 10/12] nix: make release.nix an attrset This is typical, because it allows for extending it with other derivations without breaking other Nix code. --- default.nix | 2 +- nix/release.nix | 8 +++++--- shell.nix | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/default.nix b/default.nix index 1263ad3..a7c485d 100644 --- a/default.nix +++ b/default.nix @@ -1 +1 @@ -import ./nix/release.nix +(import ./nix/release.nix {}).pdf diff --git a/nix/release.nix b/nix/release.nix index d659204..cc80473 100644 --- a/nix/release.nix +++ b/nix/release.nix @@ -5,7 +5,9 @@ let tex = import ./tex-toolchain.nix { inherit pkgs; }; inherit (import sources."gitignore.nix" { inherit (pkgs) lib; }) gitignoreSource; in -pkgs.callPackage ./build.nix { - inherit gitignoreSource; - inherit tex; +{ + pdf = pkgs.callPackage ./build.nix { + inherit gitignoreSource; + inherit tex; + }; } diff --git a/shell.nix b/shell.nix index 1db8da2..8ad673e 100644 --- a/shell.nix +++ b/shell.nix @@ -15,6 +15,6 @@ pkgs.mkShell { ]; inputsFrom = [ - thisPackage + thisPackage.pdf ]; } From 2f118a83995e1c2863d481c3077d62cc6f2090c5 Mon Sep 17 00:00:00 2001 From: Julian Stecklina Date: Sat, 21 Jan 2023 16:22:11 +0100 Subject: [PATCH 11/12] nix: don't explicitly call make Nix is smart enough to figure this out on its own when a Makefile is present. --- nix/build.nix | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/nix/build.nix b/nix/build.nix index 1fd2215..dc26e06 100644 --- a/nix/build.nix +++ b/nix/build.nix @@ -1,4 +1,4 @@ -{ stdenvNoCC, gitignoreSource, tex }: +{ stdenvNoCC, gitignoreSource, tex, gnumake }: stdenvNoCC.mkDerivation { pname = "latex-template"; @@ -7,6 +7,7 @@ stdenvNoCC.mkDerivation { src = gitignoreSource ../.; nativeBuildInputs = [ + gnumake tex ]; @@ -16,10 +17,6 @@ stdenvNoCC.mkDerivation { TEXMFVAR = "/tmp/texlive/"; TEXTMFHOME = "/tmp/texlive/"; - buildPhase = '' - make - ''; - installPhase = '' mkdir -p $out install -m 0644 diplom.pdf $out/ From e523f720f240b73b3d312ad4bf6b2b2cf512a908 Mon Sep 17 00:00:00 2001 From: Julian Stecklina Date: Sat, 21 Jan 2023 16:24:35 +0100 Subject: [PATCH 12/12] docs: fix markdown formatting --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 14ef3c6..1eb04f2 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,9 @@ Dieses Diplomarbeits-Latex-Template stellt ein Skelett für eine Diplomarbeit mit zugehöriger Make-Datei zur Verfügung. ## Checkout Submodules First -In order to use the `$ make checkbiw` script please execute: `git submodule update --init --recursive` + +Um das `$ make checkbiw` ausführen zu können, musst du zuerst die +Submodule auschecken: `git submodule update --init --recursive` ## So geht's los @@ -28,14 +30,17 @@ standardmäßig eingestellt. Für deutschen Text kann der letzte `\selectlanguag Aufruf in `diplom.tex` einfach weggelassen werden. ## How To Build + - `$ make`: regular build that produces `diplom.pdf` and `yyyy-mm-dd_hhmmss DRAFT Diplomarbeit - Branch .pdf`. - `$ make watch`: Performs a watch task, i.e. automatically re-builds everything quickly on changes. If your PDF viewer supports automatic reload on file changes (such as the default PDF viewer in GNOME) you get a cool productive working environment. ### Build Prerequisites (Regular Build) + In case you don't want to install `texlive-full` to save disk space, the following packages are actually required: \ + ```shell $ sudo apt install texlive-base \ texlive-lang-german \ @@ -51,6 +56,7 @@ $ sudo apt install texlive-base \ ``` Additionally, please install also: + ```shell $ sudo apt install \ `# for the `make checkbiw` script` @@ -60,6 +66,7 @@ $ sudo apt install \ ``` ### Build Prerequisites (Nix Build) + This template can also be built using [Nix](https://nixos.org/download.html). You have the option to either use `$ nix-build`, which will produce `result/diplom.pdf`, or to use