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:
parent
3f3fa731ad
commit
983f8a1bb9
8 changed files with 93 additions and 0 deletions
3
.github/CODEOWNERS
vendored
3
.github/CODEOWNERS
vendored
|
@ -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
|
||||
|
|
|
@ -388,4 +388,10 @@
|
|||
githubId = 68489118;
|
||||
name = "tomodachi94";
|
||||
};
|
||||
NateCox = {
|
||||
name = "Nate Cox";
|
||||
email = "nate@natecox.dev";
|
||||
github = "natecox";
|
||||
githubId = 2782695;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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'.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
45
modules/programs/git-cliff.nix
Normal file
45
modules/programs/git-cliff.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -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
|
||||
|
|
1
tests/modules/programs/git-cliff/default.nix
Normal file
1
tests/modules/programs/git-cliff/default.nix
Normal file
|
@ -0,0 +1 @@
|
|||
{ git-cliff-example-settings = ./example-settings.nix; }
|
29
tests/modules/programs/git-cliff/example-settings.nix
Normal file
29
tests/modules/programs/git-cliff/example-settings.nix
Normal 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
|
||||
''
|
||||
}
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue