nixos/git: support system-wide gitattributes
This makes it possible to configure system-wide diff, merge, etc. strategies. Unfortunately, there's no equivalent for gitignore (without clobbering `core.excludesFile`) .
This commit is contained in:
@@ -84,6 +84,20 @@ in
|
||||
|
||||
enablePureSSHTransfer = lib.mkEnableOption "Enable pure SSH transfer in server side by adding git-lfs-transfer to environment.systemPackages";
|
||||
};
|
||||
|
||||
attributes = lib.mkOption {
|
||||
type = lib.types.lines;
|
||||
default = "";
|
||||
example = "*.pdf diff=pdf";
|
||||
description = ''
|
||||
Assign git attributes to files (one pattern per line):
|
||||
|
||||
PATTERN1 ATTR1 ATTR2 ...
|
||||
|
||||
Blank lines and lines beginning with # are ignored. See
|
||||
{manpage}`gitattributes(5)` for more information.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -93,6 +107,10 @@ in
|
||||
environment.etc.gitconfig = lib.mkIf (cfg.config != [ ]) {
|
||||
text = lib.concatMapStringsSep "\n" lib.generators.toGitINI cfg.config;
|
||||
};
|
||||
|
||||
environment.etc.gitattributes = lib.mkIf (cfg.attributes != "") {
|
||||
text = cfg.attributes + "\n";
|
||||
};
|
||||
})
|
||||
(lib.mkIf (cfg.enable && cfg.lfs.enable) {
|
||||
environment.systemPackages = lib.mkMerge [
|
||||
|
||||
Reference in New Issue
Block a user