fork/home-manager

git clone https://git.julia.blue/fork/home-manager

Robert HelgessonMerge PR #421575790441

master
984 B45 linesraw
1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6
7  cfg = config.programs.git-cliff;
8  tomlFormat = pkgs.formats.toml { };
9
10in {
11  meta.maintainers = [ hm.maintainers.NateCox ];
12
13  options.programs.git-cliff = {
14    enable = mkEnableOption "git-cliff changelog generator";
15
16    package = mkPackageOption pkgs "git-cliff" { };
17
18    settings = mkOption {
19      type = tomlFormat.type;
20      default = { };
21      example = literalExpression ''
22        {
23          header = "Changelog";
24          trim = true;
25        }
26      '';
27      description = ''
28        Configuration written to
29        {file}`$XDG_CONFIG_HOME/git-cliff/cliff.toml`. See
30        <https://git-cliff.org/docs/configuration>
31        for the documentation.
32      '';
33    };
34  };
35
36  config = mkIf cfg.enable {
37    home.packages = [ cfg.package ];
38
39    xdg.configFile = {
40      "git-cliff/cliff.toml" = mkIf (cfg.settings != { }) {
41        source = tomlFormat.generate "git-cliff-config" cfg.settings;
42      };
43    };
44  };
45}