modules: move development/git to shared
This commit is contained in:
parent
2ac375204e
commit
cfe00c1331
6 changed files with 277 additions and 286 deletions
90
modules/shared/development/git/default.nix
Normal file
90
modules/shared/development/git/default.nix
Normal file
|
@ -0,0 +1,90 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
username = config.chvp.username;
|
||||
in
|
||||
{
|
||||
options.chvp.development.git = {
|
||||
enable = lib.mkOption {
|
||||
default = false;
|
||||
example = true;
|
||||
};
|
||||
email = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "charlotte@vanpetegem.be";
|
||||
example = "charlotte@vanpetegem.be";
|
||||
description = ''
|
||||
Default email set in global git config.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.chvp.development.git.enable {
|
||||
chvp.base.emacs.extraConfig = [
|
||||
''
|
||||
;; Magit GitHub/GitLab integration
|
||||
(use-package forge
|
||||
:after magit)
|
||||
|
||||
;; Git integration
|
||||
(use-package magit
|
||||
:init
|
||||
(setq forge-add-default-bindings nil)
|
||||
:general
|
||||
(lmap
|
||||
"g" '(:ignore t :which-key "git")
|
||||
"gs" '(magit-status :which-key "status")
|
||||
)
|
||||
)
|
||||
|
||||
;; Project management
|
||||
(use-package project
|
||||
:custom
|
||||
(project-switch-commands
|
||||
'(
|
||||
(project-find-file "find file")
|
||||
(consult-ripgrep "find regexp" ?r)
|
||||
(project-eshell "eshell")
|
||||
)
|
||||
"Change default actions when switching project"
|
||||
)
|
||||
:general
|
||||
(lmap
|
||||
"p" '(:ignore t :which-key "project")
|
||||
"pf" '(project-find-file :which-key "find")
|
||||
"pp" '(project-switch-project :which-key "switch")
|
||||
"pr" '(project-query-replace-regexp :which-key "replace")
|
||||
"ps" '(consult-ripgrep :search "incsearch")
|
||||
"pS" '(project-find-regexp :which-key "search")
|
||||
"p!" '(project-shell-command :which-key "command")
|
||||
"p&" '(project-async-shell-command :which-key "task")
|
||||
)
|
||||
)
|
||||
''
|
||||
];
|
||||
home-manager.users.${username} = {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
lfs.enable = true;
|
||||
extraConfig = {
|
||||
branch.autosetuprebase = "always";
|
||||
github.user = "chvp";
|
||||
merge.conflictStyle = "diff3";
|
||||
pull.rebase = true;
|
||||
rebase.autoStash = true;
|
||||
rerere.enabled = true;
|
||||
};
|
||||
ignores = [
|
||||
".DS_Store"
|
||||
".data"
|
||||
".direnv"
|
||||
".envrc"
|
||||
".idea"
|
||||
".dir-locals.el"
|
||||
];
|
||||
userEmail = config.chvp.development.git.email;
|
||||
userName = "Charlotte Van Petegem";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue