nixos/git: add lfs option to allow enabling and installing lfs easily
Co-authored-by: figsoda <figsoda@pm.me>
This commit is contained in:
parent
28b259bbb4
commit
c84b55bbe6
1 changed files with 30 additions and 6 deletions
|
@ -31,15 +31,39 @@ in
|
||||||
section of git-config(1) for more information.
|
section of git-config(1) for more information.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
lfs = {
|
||||||
|
enable = mkEnableOption "git-lfs";
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = pkgs.git-lfs;
|
||||||
|
defaultText = literalExpression "pkgs.git-lfs";
|
||||||
|
description = "The git-lfs package to use";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkMerge [
|
||||||
environment.systemPackages = [ cfg.package ];
|
(mkIf cfg.enable {
|
||||||
environment.etc.gitconfig = mkIf (cfg.config != {}) {
|
environment.systemPackages = [ cfg.package ];
|
||||||
text = generators.toGitINI cfg.config;
|
environment.etc.gitconfig = mkIf (cfg.config != {}) {
|
||||||
};
|
text = generators.toGitINI cfg.config;
|
||||||
};
|
};
|
||||||
|
})
|
||||||
|
(mkIf (cfg.enable && cfg.lfs.enable) {
|
||||||
|
environment.systemPackages = [ cfg.lfs.package ];
|
||||||
|
programs.git.config = {
|
||||||
|
filter.lfs = {
|
||||||
|
clean = "git-lfs clean -- %f";
|
||||||
|
smudge = "git-lfs smudge -- %f";
|
||||||
|
process = "git-lfs filter-process";
|
||||||
|
required = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
meta.maintainers = with maintainers; [ figsoda ];
|
meta.maintainers = with maintainers; [ figsoda ];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue