Skip to content

Commit

Permalink
feat(core): add git configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
yunfachi committed Nov 22, 2023
1 parent 1938b47 commit 7e73a10
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
4 changes: 4 additions & 0 deletions home/core.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
nixosVersion,
...
}: {
imports = [
./core
];

home = {
username = username;
homeDirectory = lib.mkForce "/home/${username}";
Expand Down
5 changes: 5 additions & 0 deletions home/core/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{...}: {
imports = [
./git.nix
];
}
38 changes: 38 additions & 0 deletions home/core/git.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
config,
lib,
userfullname,
useremail,
...
}: {
home.activation.removeExistingGitconfig = lib.hm.dag.entryBefore ["checkLinkTargets"] ''
rm -f ~/.gitconfig
'';

programs.git = {
enable = true;
lfs.enable = true;

userName = userfullname;
userEmail = useremail;

extraConfig = {
init.defaultBranch = "master";
push.autoSetupRemote = true;
pull.rebase = true;

# replace https with ssh
url = {
"ssh://[email protected]/" = {
insteadOf = "https://github.com/";
};
"ssh://[email protected]/" = {
insteadOf = "https://gitlab.com/";
};
"ssh://[email protected]/" = {
insteadOf = "https://bitbucket.com/";
};
};
};
};
}

0 comments on commit 7e73a10

Please sign in to comment.