nix config for my personal machines
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

adds gitconfig parameters

+67 -18
+67 -18
modules/home/common.nix
··· 1 1 {pkgs, ...}: { 2 - # Home Manager needs a bit of information about you and the 3 - # paths it should manage. 2 + # This value determines the Home Manager release that your 3 + # configuration is compatible with. This helps avoid breakage 4 + # when a new Home Manager release introduces backwards 5 + # incompatible changes. 6 + # 7 + # You can update Home Manager without changing this value. See 8 + # the Home Manager release notes for a list of state version 9 + # changes in each release. 10 + home.stateVersion = "25.11"; 11 + 12 + # Let Home Manager install and manage itself. 13 + programs.home-manager.enable = true; 14 + 4 15 home.username = "francisco"; 5 16 # home.homeDirectory is usually set automatically by the module depending on OS 6 17 ··· 15 26 "$HOME/.local/bin" 16 27 ]; 17 28 18 - # This value determines the Home Manager release that your 19 - # configuration is compatible with. This helps avoid breakage 20 - # when a new Home Manager release introduces backwards 21 - # incompatible changes. 22 - # 23 - # You can update Home Manager without changing this value. See 24 - # the Home Manager release notes for a list of state version 25 - # changes in each release. 26 - home.stateVersion = "25.11"; 29 + # Global Git Hooks 30 + home.file.".githooks/pre-commit" = { 31 + executable = true; 32 + text = '' 33 + #!/bin/sh 34 + 35 + BRANCH="$(git rev-parse --abbrev-ref HEAD)" 36 + # change 'origin' if your remote name differs 37 + REMOTE="origin" 38 + 39 + # Ensure origin/BRANCH exists 40 + if ! git show-ref --verify --quiet "refs/remotes/$REMOTE/$BRANCH"; then 41 + # remote branch doesn't exist — allow commit 42 + exit 0 43 + fi 44 + 45 + # If origin/BRANCH is ancestor of local branch, local has or includes remote commits => allow 46 + if git merge-base --is-ancestor "$REMOTE/$BRANCH" "$BRANCH"; then 47 + exit 0 48 + fi 27 49 28 - # Let Home Manager install and manage itself. 29 - programs.home-manager.enable = true; 50 + echo "Commit blocked: your branch is missing commits from $REMOTE/$BRANCH." 51 + echo "Run: git fetch $REMOTE && git rebase $REMOTE/$BRANCH (or git merge) then commit again." 52 + exit 1 53 + ''; 54 + }; 30 55 31 56 # Shared Packages 32 57 home.packages = with pkgs; [ ··· 156 181 # Git Configuration 157 182 programs.git = { 158 183 enable = true; 159 - settings = { 160 - user.name = "Francisco Abarzua"; 161 - user.email = "git.id@frabarz.cl"; 162 - init.defaultBranch = "main"; 163 - pull.rebase = true; 184 + userName = "Francisco Abarzua"; 185 + userEmail = "git.id@frabarz.cl"; 186 + ignores = [ 187 + ".DS_Store" 188 + ".vscode/" 189 + "shell.nix" 190 + "Thumbs.db" 191 + ]; 192 + aliases = { 193 + undo = "reset --soft HEAD~1"; 194 + }; 195 + extraConfig = { 196 + core = { 197 + editor = "nano"; 198 + hooksPath = "~/.githooks"; 199 + }; 200 + customBranch = { 201 + displayStatus = true; 202 + }; 203 + init = { 204 + defaultBranch = "main"; 205 + }; 206 + merge = { 207 + conflictstyle = "zdiff3"; 208 + }; 209 + pull = { 210 + rebase = true; 211 + }; 164 212 }; 165 213 }; 166 214 ··· 171 219 enableGitIntegration = true; 172 220 options = { 173 221 navigate = true; 222 + line-numbers = true; 174 223 light = false; 175 224 }; 176 225 };