1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2024-12-14 11:57:55 +00:00

git-cliff: add module

This commit is contained in:
Nate Cox 2023-05-05 10:25:28 -07:00 committed by Robert Helgesson
parent 3f3fa731ad
commit 983f8a1bb9
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
8 changed files with 93 additions and 0 deletions

3
.github/CODEOWNERS vendored
View file

@ -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

View file

@ -388,4 +388,10 @@
githubId = 68489118;
name = "tomodachi94";
};
NateCox = {
name = "Nate Cox";
email = "nate@natecox.dev";
github = "natecox";
githubId = 2782695;
};
}

View file

@ -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'.
'';
}
];
};
}

View file

@ -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

View file

@ -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
<filename>$XDG_CONFIG_HOME/git-cliff/cliff.toml</filename>. See
<link xlink:href="https://git-cliff.org/docs/configuration" />
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;
};
};
};
}

View file

@ -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

View file

@ -0,0 +1 @@
{ git-cliff-example-settings = ./example-settings.nix; }

View file

@ -0,0 +1,29 @@
{ config, lib, pkgs, ... }:
with lib;
{
programs.git-cliff = {
enable = true;
settings = {
header = "Changelog";
footer = "<!-- generated by git-cliff -->";
trim = true;
};
};
test.stubs.git-cliff = { };
nmt.script = ''
assertFileContent \
home-files/.config/git-cliff/cliff.toml \
${
builtins.toFile "expected.toml" ''
footer = "<!-- generated by git-cliff -->"
header = "Changelog"
trim = true
''
}
'';
}