refactor(homeModules): move git config to module

This commit is contained in:
Mohammad Rafiq 2025-05-20 11:39:37 +08:00
parent 95146e2cdf
commit 991a10ca18
No known key found for this signature in database
4 changed files with 15 additions and 4 deletions

View file

@ -1,7 +1,6 @@
{ config, lib, pkgs, osConfig, ... }: { config, lib, pkgs, osConfig, ... }:
{ {
imports = [ imports = [
./cli/git.nix
./cli/zsh.nix ./cli/zsh.nix
]; ];

View file

@ -8,6 +8,9 @@
cli.editor = "nvf"; cli.editor = "nvf";
cli.file-browser = "yazi"; cli.file-browser = "yazi";
cli.git.name = "Mohammad Rafiq";
cli.git.email = "rafiq@rrv.sh";
cli.git.defaultBranch = "prime";
home.shellAliases.v = "nvim"; home.shellAliases.v = "nvim";
home.shellAliases = { home.shellAliases = {

View file

@ -3,6 +3,7 @@
imports = [ imports = [
./file-browser/yazi.nix ./file-browser/yazi.nix
./editor/nvf.nix ./editor/nvf.nix
./utilities/git.nix
]; ];
options.cli = { options.cli = {

View file

@ -1,5 +1,12 @@
{lib,config,...}: {lib,config,...}:
{ {
options.cli.git = {
name = lib.pantheon.mkStrOption;
email = lib.pantheon.mkStrOption;
defaultBranch = lib.pantheon.mkStrOption;
};
config = {
home.sessionVariables.GIT_CONFIG_GLOBAL = "$HOME/.config/git/config"; home.sessionVariables.GIT_CONFIG_GLOBAL = "$HOME/.config/git/config";
home.shellAliases = { home.shellAliases = {
gs = "git status"; gs = "git status";
@ -10,16 +17,17 @@
}; };
programs.git = { programs.git = {
enable = true; enable = true;
userName = "Mohammad Rafiq"; userName = config.cli.git.name;
userEmail = "rafiq@rrv.sh"; userEmail = config.cli.git.email;
signing.key = "~/.ssh/id_ed25519.pub"; signing.key = "~/.ssh/id_ed25519.pub";
signing.signByDefault = true; signing.signByDefault = true;
extraConfig = { extraConfig = {
init.defaultBranch = "prime"; init.defaultBranch = config.cli.git.defaultBranch;
push.autoSetupRemote = true; push.autoSetupRemote = true;
pull.rebase = false; pull.rebase = false;
core.editor = "$EDITOR"; core.editor = "$EDITOR";
gpg.format = "ssh"; gpg.format = "ssh";
}; };
}; };
};
} }