diff --git a/homes/x86_64-linux/alejandro/default.nix b/homes/x86_64-linux/alejandro/default.nix index 01daa86..dc00108 100644 --- a/homes/x86_64-linux/alejandro/default.nix +++ b/homes/x86_64-linux/alejandro/default.nix @@ -11,5 +11,9 @@ apps = { tmux.enable = true; }; + + tools = { + git.enable = true; + }; }; } diff --git a/modules/home/tmux/default.nix b/modules/home/apps/tmux/default.nix similarity index 100% rename from modules/home/tmux/default.nix rename to modules/home/apps/tmux/default.nix diff --git a/modules/home/tools/git/default.nix b/modules/home/tools/git/default.nix new file mode 100644 index 0000000..716b046 --- /dev/null +++ b/modules/home/tools/git/default.nix @@ -0,0 +1,87 @@ +{ + config, + pkgs, + lib, + namespace, + ... +}: let + inherit (lib) mkIf mkEnableOption mkDefault; + + cfg = config.${namespace}.tools.git; +in { + options.${namespace}.tools.git = { + enable = mkEnableOption "git"; + userName = lib.options.mkOption { + type = lib.types.str; + default = "alejandro-angulo"; + description = "The name to use for git commits."; + }; + userEmail = lib.options.mkOption { + type = lib.types.str; + default = "iam@alejandr0angul0.dev"; + description = "The email to use for git commits."; + }; + signingKey = lib.options.mkOption { + type = lib.types.str; + default = "0xE1B13CCEFDEDDFB7"; + description = "The key ID used to sign commits."; + }; + }; + + config = mkIf cfg.enable { + programs.zsh.shellAliases = { + "gco" = "${pkgs.git}/bin/git checkout $(${pkgs.git}/bin/git branch | ${pkgs.fzf}/bin/fzf)"; + }; + + programs.git = { + delta = { + enable = true; + options = { + line-numbers = true; + navigate = true; + }; + }; + + enable = true; + userName = cfg.userName; + userEmail = cfg.userEmail; + + aliases = { + lol = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"; + pushup = "push -u origin HEAD"; + }; + + signing = { + key = cfg.signingKey; + signByDefault = mkDefault true; + }; + + ignores = [ + # PyCharm + ".idea/" + + # Vim artifacts + "*.swp" + "*.swo" + "tags" + ".vimspector.json" + ".vimlocal" + "Session.vim*" + + # direnv + ".envrc" + ".direnv" + ]; + + extraConfig = { + init = { + defaultBranch = "main"; + }; + + pull = { + rebase = true; + }; + }; + }; + }; +} diff --git a/modules/nixos/suites/development/default.nix b/modules/nixos/suites/development/default.nix index 22b7974..3eca7dd 100644 --- a/modules/nixos/suites/development/default.nix +++ b/modules/nixos/suites/development/default.nix @@ -16,7 +16,6 @@ in { tools = { direnv.enable = true; eza.enable = true; - git.enable = true; gpg.enable = true; zsh.enable = true; }; @@ -27,9 +26,10 @@ in { }; environment.systemPackages = with pkgs; [ - pre-commit - minio-client awscli2 + minio-client + pre-commit + git ]; }; } diff --git a/modules/nixos/tools/git/default.nix b/modules/nixos/tools/git/default.nix deleted file mode 100644 index 8d0e70e..0000000 --- a/modules/nixos/tools/git/default.nix +++ /dev/null @@ -1,88 +0,0 @@ -{ - options, - config, - pkgs, - lib, - ... -}: -with lib; let - cfg = config.aa.tools.git; - gpg = config.aa.tools.gpg; - user = config.aa.user; -in { - options.aa.tools.git = with types; { - enable = mkEnableOption "git"; - userName = mkOption { - type = str; - default = user.fullName; - description = "The name to use for git commits."; - }; - userEmail = mkOption { - type = str; - default = user.email; - description = "The email to use for git commits."; - }; - signingKey = mkOption { - type = str; - default = "0xE1B13CCEFDEDDFB7"; - description = "The key ID used to sign commits."; - }; - }; - - config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [git]; - - aa.home.extraOptions = { - programs.git = { - delta = { - enable = true; - options = { - line-numbers = true; - navigate = true; - }; - }; - - enable = true; - userName = cfg.userName; - userEmail = cfg.userEmail; - - aliases = { - lol = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"; - pushup = "push -u origin HEAD"; - }; - - signing = { - key = cfg.signingKey; - signByDefault = mkIf config.aa.tools.gpg.enable true; - }; - - ignores = [ - # PyCharm - ".idea/" - - # Vim artifacts - "*.swp" - "*.swo" - "tags" - ".vimspector.json" - ".vimlocal" - "Session.vim*" - - # direnv - ".envrc" - ".direnv" - ]; - - extraConfig = { - init = { - defaultBranch = "main"; - }; - - pull = { - rebase = true; - }; - }; - }; - }; - }; -} diff --git a/systems/x86_64-vm/virt/default.nix b/systems/x86_64-vm/virt/default.nix index 199e971..42d01a4 100644 --- a/systems/x86_64-vm/virt/default.nix +++ b/systems/x86_64-vm/virt/default.nix @@ -18,7 +18,6 @@ with lib; { nix.enable = true; suites.desktop.enable = true; - tools.git.enable = true; tools.zsh.enable = true; tools.eza.enable = true; apps.neovim.enable = true;