From 44e31a020462b68f1c85430b7c3ed09b7a2fb99e Mon Sep 17 00:00:00 2001
From: clerie <git@clerie.de>
Date: Wed, 27 Mar 2024 23:08:42 +0100
Subject: [PATCH] Init repo

---
 .gitignore             |  1 +
 README.md              |  6 +++++
 build.lua              |  7 +++++
 flake.lock             | 27 +++++++++++++++++++
 flake.nix              | 60 ++++++++++++++++++++++++++++++++++++++++++
 tex/cletex2-letter.cls |  7 +++++
 6 files changed, 108 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 README.md
 create mode 100644 build.lua
 create mode 100644 flake.lock
 create mode 100644 flake.nix
 create mode 100644 tex/cletex2-letter.cls

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..fcfc4a1
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+result*
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e59e029
--- /dev/null
+++ b/README.md
@@ -0,0 +1,6 @@
+# cletex2
+
+
+## Ressources
+
+- https://www.latex-project.org/help/documentation/clsguide.pdf
diff --git a/build.lua b/build.lua
new file mode 100644
index 0000000..ba914bb
--- /dev/null
+++ b/build.lua
@@ -0,0 +1,7 @@
+module = "cletex2"
+
+installfiles = {"tex/*.cls" }
+sourcefiles  = installfiles
+unpackfiles  = { }
+
+typesetexe="lualatex"
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..987eebd
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,27 @@
+{
+  "nodes": {
+    "nixpkgs": {
+      "locked": {
+        "lastModified": 1707451808,
+        "narHash": "sha256-UwDBUNHNRsYKFJzyTMVMTF5qS4xeJlWoeyJf+6vvamU=",
+        "owner": "NixOS",
+        "repo": "nixpkgs",
+        "rev": "442d407992384ed9c0e6d352de75b69079904e4e",
+        "type": "github"
+      },
+      "original": {
+        "owner": "NixOS",
+        "ref": "nixpkgs-unstable",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "root": {
+      "inputs": {
+        "nixpkgs": "nixpkgs"
+      }
+    }
+  },
+  "root": "root",
+  "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..9d46e2d
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,60 @@
+{
+  inputs = {
+    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+  };
+  outputs = { self, nixpkgs, ... }: let
+    forAllSystems = f: (nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" ] (system: let
+      pkgs = import nixpkgs { inherit system; };
+    in f { inherit pkgs system; } ));
+  in {
+    packages = forAllSystems ({ pkgs, system, ...}: rec {
+      cletex2 = pkgs.stdenvNoCC.mkDerivation {
+        pname = "cletex2";
+        version = "0.0.0";
+
+        outputs = [ "out" "tex" ];
+
+        src = ./.;
+
+        nativeBuildInputs = with pkgs; [
+          (texlive.withPackages (ps: with ps; [ l3build ]))
+        ];
+
+        unpackPhase = "";
+
+        dontConfigure = true;
+
+        buildPhase = ''
+        '';
+
+        installPhase = ''
+          mkdir $out
+          mkdir $tex
+          TEXMFHOME=$tex l3build install
+        '';
+      };
+
+      cletex2-env = pkgs.texlive.withPackages (ps: with ps; [
+        cletex2
+        collection-langgerman
+        collection-latex
+        collection-luatex
+        koma-script
+        latexmk
+      ]);
+
+      cletex2mk = pkgs.writeShellApplication {
+        name = "cletex2mk";
+        runtimeInputs = [ self.packages.${system}.cletex2-env ];
+        text = ''
+          latexmk -lualatex -interaction=nonstopmode "$@"
+        '';
+      };
+    });
+
+    hydraJobs = {
+      inherit (self)
+        packages;
+    };
+  };
+}
diff --git a/tex/cletex2-letter.cls b/tex/cletex2-letter.cls
new file mode 100644
index 0000000..2c3d673
--- /dev/null
+++ b/tex/cletex2-letter.cls
@@ -0,0 +1,7 @@
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesClass{cletex2-letter}[2024-02-09]
+\LoadClass[a4paper,fromalign=right,fromrule=afteraddress]{scrlttr2}
+
+\RequirePackage[ngerman]{babel}
+
+\renewcommand*{\familydefault}{\sfdefault}