···11{pkgs, ...}: {
22- # Home Manager needs a bit of information about you and the
33- # paths it should manage.
22+ # This value determines the Home Manager release that your
33+ # configuration is compatible with. This helps avoid breakage
44+ # when a new Home Manager release introduces backwards
55+ # incompatible changes.
66+ #
77+ # You can update Home Manager without changing this value. See
88+ # the Home Manager release notes for a list of state version
99+ # changes in each release.
1010+ home.stateVersion = "25.11";
1111+1212+ # Let Home Manager install and manage itself.
1313+ programs.home-manager.enable = true;
1414+415 home.username = "francisco";
516 # home.homeDirectory is usually set automatically by the module depending on OS
617···1526 "$HOME/.local/bin"
1627 ];
17281818- # This value determines the Home Manager release that your
1919- # configuration is compatible with. This helps avoid breakage
2020- # when a new Home Manager release introduces backwards
2121- # incompatible changes.
2222- #
2323- # You can update Home Manager without changing this value. See
2424- # the Home Manager release notes for a list of state version
2525- # changes in each release.
2626- home.stateVersion = "25.11";
2929+ # Global Git Hooks
3030+ home.file.".githooks/pre-commit" = {
3131+ executable = true;
3232+ text = ''
3333+ #!/bin/sh
3434+3535+ BRANCH="$(git rev-parse --abbrev-ref HEAD)"
3636+ # change 'origin' if your remote name differs
3737+ REMOTE="origin"
3838+3939+ # Ensure origin/BRANCH exists
4040+ if ! git show-ref --verify --quiet "refs/remotes/$REMOTE/$BRANCH"; then
4141+ # remote branch doesn't exist — allow commit
4242+ exit 0
4343+ fi
4444+4545+ # If origin/BRANCH is ancestor of local branch, local has or includes remote commits => allow
4646+ if git merge-base --is-ancestor "$REMOTE/$BRANCH" "$BRANCH"; then
4747+ exit 0
4848+ fi
27492828- # Let Home Manager install and manage itself.
2929- programs.home-manager.enable = true;
5050+ echo "Commit blocked: your branch is missing commits from $REMOTE/$BRANCH."
5151+ echo "Run: git fetch $REMOTE && git rebase $REMOTE/$BRANCH (or git merge) then commit again."
5252+ exit 1
5353+ '';
5454+ };
30553156 # Shared Packages
3257 home.packages = with pkgs; [
···156181 # Git Configuration
157182 programs.git = {
158183 enable = true;
159159- settings = {
160160- user.name = "Francisco Abarzua";
161161- user.email = "git.id@frabarz.cl";
162162- init.defaultBranch = "main";
163163- pull.rebase = true;
184184+ userName = "Francisco Abarzua";
185185+ userEmail = "git.id@frabarz.cl";
186186+ ignores = [
187187+ ".DS_Store"
188188+ ".vscode/"
189189+ "shell.nix"
190190+ "Thumbs.db"
191191+ ];
192192+ aliases = {
193193+ undo = "reset --soft HEAD~1";
194194+ };
195195+ extraConfig = {
196196+ core = {
197197+ editor = "nano";
198198+ hooksPath = "~/.githooks";
199199+ };
200200+ customBranch = {
201201+ displayStatus = true;
202202+ };
203203+ init = {
204204+ defaultBranch = "main";
205205+ };
206206+ merge = {
207207+ conflictstyle = "zdiff3";
208208+ };
209209+ pull = {
210210+ rebase = true;
211211+ };
164212 };
165213 };
166214···171219 enableGitIntegration = true;
172220 options = {
173221 navigate = true;
222222+ line-numbers = true;
174223 light = false;
175224 };
176225 };