diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 80ba8c48..6d50bbab 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -122,6 +122,9 @@ Makefile @thiagokokada
/modules/programs/gh.nix @Gerschtli @berbiche
/tests/modules/programs/gh @Gerschtli @berbiche
+/modules/programs/git-cliff.nix @NateCox
+/tests/modules/programs/git-cliff @NateCox
+
/modules/programs/git.nix @rycee
/modules/programs/gitui/gitui.nix @mifom
diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix
index b91ba715..5b1d35d4 100644
--- a/modules/lib/maintainers.nix
+++ b/modules/lib/maintainers.nix
@@ -388,4 +388,10 @@
githubId = 68489118;
name = "tomodachi94";
};
+ NateCox = {
+ name = "Nate Cox";
+ email = "nate@natecox.dev";
+ github = "natecox";
+ githubId = 2782695;
+ };
}
diff --git a/modules/misc/news.nix b/modules/misc/news.nix
index 1869d556..8f83572f 100644
--- a/modules/misc/news.nix
+++ b/modules/misc/news.nix
@@ -1001,6 +1001,13 @@ in
A new module is available: 'programs.jujutsu'.
'';
}
+
+ {
+ time = "2023-05-09T16:06:56+00:00";
+ message = ''
+ A new module is available: 'programs.git-cliff'.
+ '';
+ }
];
};
}
diff --git a/modules/modules.nix b/modules/modules.nix
index 025667ca..69543ab2 100644
--- a/modules/modules.nix
+++ b/modules/modules.nix
@@ -80,6 +80,7 @@ let
./programs/gallery-dl.nix
./programs/getmail.nix
./programs/gh.nix
+ ./programs/git-cliff.nix
./programs/git.nix
./programs/gitui.nix
./programs/gnome-terminal.nix
diff --git a/modules/programs/git-cliff.nix b/modules/programs/git-cliff.nix
new file mode 100644
index 00000000..7894ec6c
--- /dev/null
+++ b/modules/programs/git-cliff.nix
@@ -0,0 +1,45 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.programs.git-cliff;
+ tomlFormat = pkgs.formats.toml { };
+
+in {
+ meta.maintainers = [ hm.maintainers.NateCox ];
+
+ options.programs.git-cliff = {
+ enable = mkEnableOption "git-cliff changelog generator";
+
+ package = mkPackageOption pkgs "git-cliff" { };
+
+ settings = mkOption {
+ type = tomlFormat.type;
+ default = { };
+ example = literalExpression ''
+ {
+ header = "Changelog";
+ trim = true;
+ }
+ '';
+ description = ''
+ Configuration written to
+ $XDG_CONFIG_HOME/git-cliff/cliff.toml. See
+
+ for the documentation.
+ '';
+ };
+ };
+
+ config = mkIf cfg.enable {
+ home.packages = [ cfg.package ];
+
+ xdg.configFile = {
+ "git-cliff/cliff.toml" = mkIf (cfg.settings != { }) {
+ source = tomlFormat.generate "git-cliff-config" cfg.settings;
+ };
+ };
+ };
+}
diff --git a/tests/default.nix b/tests/default.nix
index 54ee6d13..f2e20d24 100644
--- a/tests/default.nix
+++ b/tests/default.nix
@@ -73,6 +73,7 @@ import nmt {
./modules/programs/fish
./modules/programs/gallery-dl
./modules/programs/gh
+ ./modules/programs/git-cliff
./modules/programs/git
./modules/programs/gpg
./modules/programs/helix
diff --git a/tests/modules/programs/git-cliff/default.nix b/tests/modules/programs/git-cliff/default.nix
new file mode 100644
index 00000000..3bad375c
--- /dev/null
+++ b/tests/modules/programs/git-cliff/default.nix
@@ -0,0 +1 @@
+{ git-cliff-example-settings = ./example-settings.nix; }
diff --git a/tests/modules/programs/git-cliff/example-settings.nix b/tests/modules/programs/git-cliff/example-settings.nix
new file mode 100644
index 00000000..5c865d48
--- /dev/null
+++ b/tests/modules/programs/git-cliff/example-settings.nix
@@ -0,0 +1,29 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+{
+ programs.git-cliff = {
+ enable = true;
+
+ settings = {
+ header = "Changelog";
+ footer = "";
+ trim = true;
+ };
+ };
+
+ test.stubs.git-cliff = { };
+
+ nmt.script = ''
+ assertFileContent \
+ home-files/.config/git-cliff/cliff.toml \
+ ${
+ builtins.toFile "expected.toml" ''
+ footer = ""
+ header = "Changelog"
+ trim = true
+ ''
+ }
+ '';
+}