about summary refs log tree commit diff stats
path: root/build/latex/letter/flake.nix
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-03 20:53:54 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-03 20:53:54 +0200
commitb241b009646b36891e6b6c9d336357ed595d4dc7 (patch)
tree0a47390083f6994698bb71aa524e0642912e2ae1 /build/latex/letter/flake.nix
parentfeat(templates/latex/letter): Init (diff)
downloadflake-templates-b241b009646b36891e6b6c9d336357ed595d4dc7.tar.gz
flake-templates-b241b009646b36891e6b6c9d336357ed595d4dc7.zip
chore(build): Regenerate
Diffstat (limited to 'build/latex/letter/flake.nix')
-rw-r--r--build/latex/letter/flake.nix100
1 files changed, 100 insertions, 0 deletions
diff --git a/build/latex/letter/flake.nix b/build/latex/letter/flake.nix
new file mode 100644
index 0000000..4847a9c
--- /dev/null
+++ b/build/latex/letter/flake.nix
@@ -0,0 +1,100 @@
+{
+  description = "%INIT_DESCRIPTION";
+
+  inputs = {
+    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+
+    treefmt-nix = {
+      url = "github:numtide/treefmt-nix";
+      inputs = {
+        nixpkgs.follows = "nixpkgs";
+      };
+    };
+    flake_version_update = {
+      url = "git+https://codeberg.org/soispha/flake_version_update.git";
+      inputs = {
+        systems.follows = "systems";
+        nixpkgs.follows = "nixpkgs";
+        flake-utils.follows = "flake-utils";
+      };
+    };
+
+    # inputs for following
+    systems = {
+      url = "github:nix-systems/x86_64-linux"; # only evaluate for this system
+    };
+    flake-compat = {
+      url = "github:edolstra/flake-compat";
+      flake = false;
+    };
+    flake-utils = {
+      url = "github:numtide/flake-utils";
+      inputs = {
+        systems.follows = "systems";
+      };
+    };
+  };
+
+  outputs = {
+    self,
+    nixpkgs,
+    flake-utils,
+    treefmt-nix,
+    flake_version_update,
+    ...
+  }:
+    flake-utils.lib.eachDefaultSystem (system: let
+      pkgs = nixpkgs.legacyPackages.${system};
+
+      # This version is set automatically on `cog bump --auto`;
+      version = "v%INIT_APPLICATION_VERSION"; # GUIDING VERSION STRING
+
+      # TODO reduce to the needed ones
+      texlive = pkgs.texlive.combined.scheme-full;
+
+      treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;};
+
+      build = pkgs.stdenv.mkDerivation {
+        pname = "%INIT_APPLICATION_NAME";
+        inherit version;
+        src = ./.;
+
+        buildInputs = [
+          texlive
+        ];
+
+        # Run local
+        preferLocalBuild = true;
+        allowSubstitutes = false;
+
+        buildPhase = ''
+          # TODO: I have no idea, why calling it with `./build.sh` does not work <2024-03-20>
+          bash ./build.sh
+        '';
+
+        installPhase = ''
+          install -D ./build/main.pdf "$out/%INIT_APPLICATION_NAME.pdf";
+        '';
+      };
+    in {
+      packages.default = build;
+
+      checks = {
+        inherit build;
+        formatting = treefmtEval.config.build.check self;
+      };
+
+      formatter = treefmtEval.config.build.wrapper;
+
+      devShells.default = pkgs.mkShell {
+        packages = with pkgs; [
+          cocogitto
+          reuse
+          flake_version_update.packages."${system}".default
+          texlive
+
+          zathura
+        ];
+      };
+    });
+}