My Nix Configuration
1{ 2 pkgs, 3 lib, 4 config, 5 ... 6}: 7let 8 cfg = config.py.programs.git; 9in 10{ 11 options.py.programs.git = { 12 enable = lib.mkEnableOption "git configuration"; 13 lazygit.enable = lib.mkEnableOption "lazygit configuration"; 14 gh.enable = lib.mkEnableOption "gh configuration"; 15 }; 16 config = { 17 catppuccin = { 18 lazygit.enable = cfg.lazygit.enable; 19 }; 20 programs = { 21 git = lib.mkIf cfg.enable { 22 enable = true; 23 package = pkgs.git; 24 settings = { 25 branch.sort = "-committerdate"; 26 column.ui = "auto"; 27 core.editor = lib.getExe pkgs.neovim; 28 "credential \"https://git.pyrox.dev\"".username = "pyrox"; 29 credential.helper = "rbw"; 30 diff = { 31 algorithm = "histogram"; 32 colorMoved = "plain"; 33 mnemonicPrefix = true; 34 renames = true; 35 }; 36 fetch = { 37 all = true; 38 prune = true; 39 pruneTags = true; 40 }; 41 gpg.ssh.allowedSignersFile = "~/.ssh/authorized_signatures"; 42 init.defaultBranch = "main"; 43 pull.rebase = false; 44 push = { 45 autoSetupRemote = true; 46 followTags = true; 47 }; 48 rebase.updateRefs = true; 49 tag.sort = "version:refname"; 50 lfs = { 51 enable = true; 52 skipSmudge = false; 53 }; 54 user = { 55 email = "pyrox@pyrox.dev"; 56 name = "dish"; 57 }; 58 signing = { 59 key = "~/.ssh/main.pub"; 60 format = "ssh"; 61 signByDefault = true; 62 }; 63 }; 64 }; 65 delta = { 66 enable = true; 67 options.line-numbers = true; 68 enableGitIntegration = true; 69 }; 70 mergiraf = lib.mkIf cfg.enable { 71 enable = true; 72 }; 73 lazygit = lib.mkIf cfg.lazygit.enable { 74 enable = true; 75 settings = { 76 gui = { 77 nerdFontsVersion = "3"; 78 showRandomTip = false; 79 theme.selectedLineBgColor = [ "default" ]; 80 }; 81 git.paging = { 82 pager = "${lib.getExe pkgs.delta} --dark --paging=never"; 83 colorArg = "always"; 84 }; 85 services = { 86 "git.pyrox.dev" = "gitea:git.pyrox.dev"; 87 "git.dn42.dev" = "gitea:git.dn42.dev"; 88 "codeberg.org" = "gitea:codeberg.org"; 89 }; 90 }; 91 }; 92 gh = lib.mkIf cfg.gh.enable { 93 enable = true; 94 gitCredentialHelper.enable = true; 95 settings = { 96 editor = lib.getExe pkgs.neovim; 97 git_protocol = "https"; 98 browser = lib.mkIf config.py.profiles.gui.enable pkgs.firefox; 99 prompt = "enabled"; 100 }; 101 }; 102 }; 103 }; 104}