diff options
Diffstat (limited to 'home')
-rw-r--r-- | home/git/commit.template | 22 | ||||
-rw-r--r-- | home/git/default.nix | 84 |
2 files changed, 66 insertions, 40 deletions
diff --git a/home/git/commit.template b/home/git/commit.template new file mode 100644 index 0000000..01ab956 --- /dev/null +++ b/home/git/commit.template @@ -0,0 +1,22 @@ +# (If applied, this commit will...) <type>: <subject> + +# Explain why this change is being made + +# --- COMMIT END --- +# Remember to +# Use the imperative mood, present tense: `change' not `changed' nor `changes' +# Do not end the subject line with a period +# Use the body to explain what and why vs. how +# Can use multiple lines with "-" for bullet points in body + +# Suggested types: +# build: Changes that affect the build system or external dependencies +# ci: Changes to CI configuration files and scripts +# docs: Documentation only changes +# feat: A new feature +# fix: A bug fix +# perf: A code change that improves performance +# ref: A code change that neither fixes a bug nor adds a feature (refactor) +# style: Changes that do not affect the meaning of the code +# tests: Adding missing tests or correcting existing tests +# meta: Some meta information in the repo changes diff --git a/home/git/default.nix b/home/git/default.nix index bcf32ac..3dc2dd0 100644 --- a/home/git/default.nix +++ b/home/git/default.nix @@ -6,46 +6,50 @@ in { enable = mkEnableOption "git configuration"; }; - config.programs.git = lib.mkIf cfg.enable { - enable = true; - aliases = { - s = "status --short --branch"; - amend = "commit --amend --no-edit"; + config = lib.mkIf cfg.enable { + programs.git = { + enable = true; + aliases = { + s = "status --short --branch"; + amend = "commit --amend --no-edit"; + }; + extraConfig = { + core.whitespace = "trailing-space,space-before-tab"; + color.ui = "true"; + push.default = "simple"; + init.defaultBranch = "main"; + branch.autosetuprebase = "remote"; + branch.sort = "authordate"; + commit.template = "${config.xdg.dataHome}/git/commit.template"; + }; + userName = "Franck Cuny"; + userEmail = "franck@fcuny.net"; + extraConfig = { + "credential \"https://github.com\"" = { username = "fcuny"; }; + "credential \"https://git.fcuny.net\"" = { username = "fcuny"; }; + }; + ignores = [ + "*.elc" + "*.iml" + "*.o" + "*.pyc" + "*.pyo" + "*pyc" + "*~" + ".DS_Store" + ".\\#" + ".dir-locals.el" + ".direnv/*" + ".idea" + ".projectile" + ".pytest_cache/" + "/env/*" + "Icon" + "TAGS" + "\\#*\\#" + "tags" + ]; }; - extraConfig = { - core.whitespace = "trailing-space,space-before-tab"; - color.ui = "true"; - push.default = "simple"; - init.defaultBranch = "main"; - branch.autosetuprebase = "remote"; - branch.sort = "authordate"; - }; - userName = "Franck Cuny"; - userEmail = "franck@fcuny.net"; - extraConfig = { - "credential \"https://github.com\"" = { username = "fcuny"; }; - "credential \"https://git.fcuny.net\"" = { username = "fcuny"; }; - }; - ignores = [ - "*.elc" - "*.iml" - "*.o" - "*.pyc" - "*.pyo" - "*pyc" - "*~" - ".DS_Store" - ".\\#" - ".dir-locals.el" - ".direnv/*" - ".idea" - ".projectile" - ".pytest_cache/" - "/env/*" - "Icon" - "TAGS" - "\\#*\\#" - "tags" - ]; + xdg.dataFile."git/commit.template" = { source = ./commit.template; }; }; } |