about summary refs log tree commit diff stats
path: root/templates/c
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-03-31 23:44:59 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-04-01 00:00:07 +0200
commit2bb1c6d4948eecbdacea1267ee0a132aa88a7b5c (patch)
treed9894056cafdf83fd7edb7b785ac6076cdc177cc /templates/c
parentrefactor(flake): Move some nix code out of flake.nix (diff)
downloadflake-templates-2bb1c6d4948eecbdacea1267ee0a132aa88a7b5c.tar.gz
flake-templates-2bb1c6d4948eecbdacea1267ee0a132aa88a7b5c.zip
fix(templates): Update already done templates with improvements from new ones
Diffstat (limited to 'templates/c')
-rw-r--r--templates/c/.envrc3
-rw-r--r--templates/c/.licensure.yml7
-rw-r--r--templates/c/cog.toml9
-rw-r--r--templates/c/flake.nix16
4 files changed, 28 insertions, 7 deletions
diff --git a/templates/c/.envrc b/templates/c/.envrc
index 77f9235..8f9d5d7 100644
--- a/templates/c/.envrc
+++ b/templates/c/.envrc
@@ -1,7 +1,8 @@
 use flake || use nix
 watch_file flake.nix
 
-PATH_add ./target/
+PATH_add ./target
+PATH_add ./scripts
 
 if on_git_branch; then
   echo && git status --short --branch &&
diff --git a/templates/c/.licensure.yml b/templates/c/.licensure.yml
index 6c8dcfc..e1f5a01 100644
--- a/templates/c/.licensure.yml
+++ b/templates/c/.licensure.yml
@@ -144,6 +144,13 @@ comments:
       comment_char: ";;;"
       trailing_lines: 1
 
+  - extensions:
+      - tex
+    commenter:
+      type: line
+      comment_char: "%"
+      trailing_lines: 1
+
   # The extension string "any" is special and so will match any file
   # extensions. Commenter configurations are always checked in the
   # order they are defined, so if any is used it should be the last
diff --git a/templates/c/cog.toml b/templates/c/cog.toml
index d34ced6..ff2c110 100644
--- a/templates/c/cog.toml
+++ b/templates/c/cog.toml
@@ -2,12 +2,11 @@ tag_prefix = "v"
 branch_whitelist = ["main", "prime"]
 ignore_merge_commits = false
 
-[commit_types]
-
 pre_bump_hooks = [
-  "nix flake check",                # verify the project builds
-  "./scripts/renew_copyright_header.sh", # update the license header in each file
-  "nix fmt",                        # format
+  "nix flake check",                                                    # verify the project builds
+  "./scripts/renew_copyright_header.sh",                                # update the license header in each file
+  "flake_version_update --version v{{version}} --input-file flake.nix", # update the version in the flake.nix file
+  "nix fmt",                                                            # format
 ]
 post_bump_hooks = [
   "git push",
diff --git a/templates/c/flake.nix b/templates/c/flake.nix
index cd4200c..e19bbd4 100644
--- a/templates/c/flake.nix
+++ b/templates/c/flake.nix
@@ -11,6 +11,15 @@
       };
     };
 
+    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
@@ -32,6 +41,7 @@
     nixpkgs,
     flake-utils,
     treefmt-nix,
+    flake_version_update,
     ...
   }:
     flake-utils.lib.eachDefaultSystem (system: let
@@ -40,8 +50,9 @@
       nativeBuildInputs = with pkgs; [valgrind pandoc];
       treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;};
 
+      # This version is set automatically on `cog bump --auto`;
+      version = "v0.1.0"; # GUIDING VERSION STRING
       pname = "TODO";
-      version = "0.1";
 
       build = pkgs.stdenv.mkDerivation {
         inherit pname version;
@@ -61,6 +72,9 @@
       devShells.default = pkgs.mkShell {
         packages = with pkgs; [
           cocogitto
+          flake_version_update.packages."${system}".default
+
+          licensure
         ];
         inherit nativeBuildInputs;
         env = {