diff options
| author | Leander Scherer <leander@schererleander.de> | 2026-01-08 02:48:11 +0100 |
|---|---|---|
| committer | Leander Scherer <leander@schererleander.de> | 2026-01-08 19:08:12 +0100 |
| commit | 6174f3650cf42aaf008012e828d5a1f8e2ce037f (patch) | |
| tree | 9bbbd99680cd5adb56596a14734d4896bc6af733 /modules/users/git | |
| parent | c582c4d0675aada46fa196b7af1941ed753d055f (diff) | |
refactor(modules): separate nixos/home-manager modules, use standard option conventions
Diffstat (limited to 'modules/users/git')
| -rw-r--r-- | modules/users/git/default.nix | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/modules/users/git/default.nix b/modules/users/git/default.nix new file mode 100644 index 0000000..f1f555e --- /dev/null +++ b/modules/users/git/default.nix @@ -0,0 +1,81 @@ +{ + config, + lib, + ... +}: +let + cfg = config.nx.git; + inherit (lib) mkOption mkIf types; +in +{ + options.nx.git = { + enable = mkOption { + description = "Enable git"; + type = types.bool; + default = false; + }; + + userName = mkOption { + description = "Git username"; + type = types.str; + default = "Leander Scherer"; + }; + + userEmail = mkOption { + description = "Git email"; + type = types.str; + default = "leander@schererleander.de"; + }; + + signKey = mkOption { + description = "Sign key"; + type = types.nullOr types.str; + default = "A3502B180BC1D41A"; + }; + + signFlavor = mkOption { + description = "Sign key flavor"; + type = types.enum [ + "ssh" + "openpgp" + ]; + default = "openpgp"; + }; + }; + + config = mkIf cfg.enable { + programs.git = { + enable = true; + + signing = mkIf (cfg.signKey != null) { + key = cfg.signKey; + signByDefault = true; + }; + + ignores = [ + "*~" + ".DS_Store" + ".direnv" + ".envrc" + ]; + + settings = { + user.name = cfg.userName; + user.email = cfg.userEmail; + help.autocorrect = 20; + alias = { + st = "status"; + co = "checkout"; + br = "branch"; + }; + pull.rebase = true; + gpg.format = cfg.signFlavor; + url."git@github.com:".insteadOf = "https://github.com"; + }; + }; + programs.diff-highlight = { + enable = true; + enableGitIntegration = true; + }; + }; +} |
