1 { config, lib, pkgs, ... }:
6 cfg = config.programs.git;
12 enable = mkEnableOption (lib.mdDoc "git");
17 defaultText = literalExpression "pkgs.git";
18 example = literalExpression "pkgs.gitFull";
19 description = lib.mdDoc "The git package to use";
26 gitini = attrsOf (attrsOf anything);
28 either gitini (listOf gitini) // {
32 (acc: { value, ... }@x: acc // (if isList value then {
33 ordered = acc.ordered ++ value;
35 unordered = acc.unordered ++ [ x ];
43 [ (gitini.merge loc config.unordered) ] ++ config.ordered;
47 init.defaultBranch = "main";
48 url."https://github.com/".insteadOf = [ "gh:" "github:" ];
50 description = lib.mdDoc ''
51 Configuration to write to /etc/gitconfig. A list can also be
52 specified to keep the configuration in order. For example, setting
53 `config` to `[ { foo.x = 42; } { bar.y = 42; }]` will put the `foo`
54 section before the `bar` section unlike the default alphabetical
55 order, which can be helpful for sections such as `include` and
56 `includeIf`. See the CONFIGURATION FILE section of git-config(1) for
62 enable = mkEnableOption (lib.mdDoc "git-lfs");
66 default = pkgs.git-lfs;
67 defaultText = literalExpression "pkgs.git-lfs";
68 description = lib.mdDoc "The git-lfs package to use";
76 environment.systemPackages = [ cfg.package ];
77 environment.etc.gitconfig = mkIf (cfg.config != [ ]) {
78 text = concatMapStringsSep "\n" generators.toGitINI cfg.config;
81 (mkIf (cfg.enable && cfg.lfs.enable) {
82 environment.systemPackages = [ cfg.lfs.package ];
83 programs.git.config = {
85 clean = "git-lfs clean -- %f";
86 smudge = "git-lfs smudge -- %f";
87 process = "git-lfs filter-process";
94 meta.maintainers = with maintainers; [ figsoda ];