nixos-config/config/programs/git.nix

65 lines
1.7 KiB
Nix
Raw Normal View History

2022-03-06 07:55:08 +00:00
{ pkgs, ... }:
let gitTemplate = pkgs.stdenv.mkDerivation {
name = "git-template";
2022-03-06 08:12:44 +00:00
src = ./.;
2022-03-06 07:55:08 +00:00
nativeBuildInputs = with pkgs; with rust-binaries; [
git
mit-commit-msg
mit-pre-commit
mit-prepare-commit-msg
];
2022-03-06 08:12:44 +00:00
buildPhase = "true";
2022-03-06 07:58:24 +00:00
installPhase = with pkgs; with rust-binaries; ''
git init $out --bare
cd $out
git branch -m main
ln -s ${mit-commit-msg}/bin/mit-commit-msg $out/hooks/commit-msg
ln -s ${mit-pre-commit}/bin/mit-pre-commit $out/hooks/pre-commit
ln -s ${mit-prepare-commit-msg}/bin/mit-prepare-commit-msg $out/hooks/prepare-commit-msg
2022-03-06 07:55:08 +00:00
'';
};
in
{
2022-01-18 13:49:11 +00:00
programs.git = {
enable = true;
package = pkgs.gitAndTools.gitFull;
lfs.enable = true;
signing.signByDefault = true;
signing.key = "AB2BD8DAF2E37122";
2022-01-18 13:49:11 +00:00
userEmail = "lotte@chir.rs";
userName = "Charlotte 🦝 Delenk";
2022-03-06 07:55:08 +00:00
extraConfig = {
2022-03-06 08:35:30 +00:00
init.templateDir = "${gitTemplate}";
"mit.lint" = {
body-wider-than-72-characters = true;
duplicated-trailers = true;
github-id-missing = true;
jira-issue-key-missing = false;
not-conventional-commit = true;
not-emoji-log = false;
pivotal-tracker-id-missing = false;
subject-line-ends-with-period = true;
subject-line-not-capitalized = false;
subject-longer-than-72-characters = true;
subject-not-separated-from-body = true;
};
2022-03-06 07:55:08 +00:00
};
2022-01-18 13:49:11 +00:00
};
2022-03-05 20:42:53 +00:00
home.packages = with pkgs.rust-binaries; [
git-mit
git-mit-config
git-mit-install
git-mit-relates-to
mit-commit-message-lints
mit-commit-msg
mit-hook-test-helper
mit-pre-commit
2022-03-05 20:44:06 +00:00
mit-prepare-commit-msg
2022-03-05 20:42:53 +00:00
];
2022-03-06 08:35:30 +00:00
xdg.configFile."git-mit/mit.toml".text = ''
[cd]
name = "Charlotte 🦝 Delenk"
email = "lotte@chir.rs"
'';
2022-01-19 08:28:39 +00:00
}