From 92369cc90b2be80f28b41e7bac3bcbc2ed6b0b9e Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Wed, 10 Jul 2024 12:37:49 +0200 Subject: [PATCH] refactor: extract git config --- flake.nix | 2 ++ horsch/git.nix => git.nix | 4 +-- horsch/home.nix | 2 +- private/git.nix | 71 --------------------------------------- private/home.nix | 2 +- 5 files changed, 6 insertions(+), 75 deletions(-) rename horsch/git.nix => git.nix (96%) delete mode 100644 private/git.nix diff --git a/flake.nix b/flake.nix index 09c265e..c920da2 100644 --- a/flake.nix +++ b/flake.nix @@ -28,6 +28,7 @@ user = "mandlm"; userName = "Michael Mandl"; userEmail = "mandlm@molez.net"; + userSigningKey = "4AA25D647AA54CC7"; theme = "dark"; }; }; @@ -42,6 +43,7 @@ user = "mmandl"; userName = "Michael Mandl"; userEmail = "michael.mandl@horsch.com"; + userSigningKey = "088ED38F036C7AF2"; theme = "dark"; }; }; diff --git a/horsch/git.nix b/git.nix similarity index 96% rename from horsch/git.nix rename to git.nix index 1fb9730..ebd6389 100644 --- a/horsch/git.nix +++ b/git.nix @@ -1,4 +1,4 @@ -{ pkgs, userName, userEmail, ... }: +{ pkgs, userName, userEmail, userSigningKey, ... }: { programs = { @@ -11,7 +11,7 @@ inherit userEmail; signing = { - key = "088ED38F036C7AF2"; + key = userSigningKey; signByDefault = true; }; diff --git a/horsch/home.nix b/horsch/home.nix index 0af011e..5b2eb7e 100644 --- a/horsch/home.nix +++ b/horsch/home.nix @@ -26,7 +26,7 @@ ../ripgrep.nix ../starship.nix ../zoxide.nix - ./git.nix + ../git.nix ./gpg ./neovim ./picocom.nix diff --git a/private/git.nix b/private/git.nix deleted file mode 100644 index da11041..0000000 --- a/private/git.nix +++ /dev/null @@ -1,71 +0,0 @@ -{ ... }: - -{ - programs = { - git = { - enable = true; - extraConfig = { - core.editor = "nvim"; - - diff.external = "difft --background light"; - diff.tool = "difftastic"; - diff.ignoreSubmodules = "none"; - - difftool.difftastic.cmd = "difft --background light \"$LOCAL\" \"$REMOTE\""; - difftool.prompt = false; - - fetch.writeCommitGraph = true; - fetch.recurseSubmodules = true; - - format.pretty = "format:%C(yellow)%h %Cblue%>(12)%ad %C(red)%G? %Cgreen%<(7,trunc)%aN%Cred%d %Creset%s"; - - init.defaultBranch = "main"; - - log.date = "relative"; - - merge.ff = false; - merge.tool = "nvim"; - - mergetool.nvim.cmd = "nvim -f -c \"Gdiffsplit!\" \"$MERGED\""; - mergetool.prompt = false; - - pager.difftool = true; - - pull.rebase = true; - - push.recurseSubmodules = "on-demand"; - - rebase.autostash = true; - - rerere.enabled = true; - - status.submoduleSummary = true; - - submodule.recurse = true; - - user.private.email = "mandlm@molez.net"; - user.private.name = "Michael Mandl"; - user.private.signingkey = "4AA25D647AA54CC7"; - - user.swp.email = "mandl@vi-bim.de"; - user.swp.name = "Michael Mandl"; - user.swp.signingkey = "4E60F44227F611B4"; - - worktree.guessRemote = true; - }; - - aliases = { - identity = ''! git config user.name "$(git config user.$1.name)"; git config user.email "$(git config user.$1.email)"; git config user.signingkey "$(git config user.$1.signingkey)"; git config commit.gpgsign "true"; : ''; - clone-worktree = ''! mkdir $2; git clone $1 $2/.base; BRANCH=`git -C $2/.base symbolic-ref --short HEAD`; echo "branch is $BRANCH"; git -C $2/.base checkout --detach HEAD; git -C $2/.base worktree add ../$BRANCH; :''; - graph = "log --graph --all --max-count 32"; - }; - - ignores = [ - ".env" - ".direnv" - "*.swp" - ]; - }; - }; -} - diff --git a/private/home.nix b/private/home.nix index cbef863..7769b43 100644 --- a/private/home.nix +++ b/private/home.nix @@ -64,7 +64,7 @@ ../starship.nix ../zoxide.nix ./firefox.nix - ./git.nix + ../git.nix ./gpg ./kitty.nix ./neovim