From ecb0dc092ec4d386fbd5b09ef8f44cf22d5261c4 Mon Sep 17 00:00:00 2001 From: Artem Sheremet Date: Fri, 15 May 2026 12:55:42 +0000 Subject: [PATCH] Migrate .gitconfig to home-manager --- flake.nix | 2 ++ hosts/common/home.nix | 22 ++++++++++++++++++++ legacy/.gitconfig | 45 ----------------------------------------- modules/home/common.nix | 38 ++++++++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 45 deletions(-) create mode 100644 hosts/common/home.nix delete mode 100644 legacy/.gitconfig diff --git a/flake.nix b/flake.nix index abb54c1..7b3e7a6 100644 --- a/flake.nix +++ b/flake.nix @@ -70,6 +70,7 @@ inputs.fw_nix.nixosModules.identities vscode-server.homeModules.default self.homeModules.linux-headless + ./hosts/common/home.nix ./hosts/deimos/home.nix ]; }; @@ -82,6 +83,7 @@ modules = [ inputs.fw_nix.nixosModules.identities self.homeModules.mac-portable + ./hosts/common/home.nix ./hosts/mars/home.nix ]; }; diff --git a/hosts/common/home.nix b/hosts/common/home.nix new file mode 100644 index 0000000..0f62910 --- /dev/null +++ b/hosts/common/home.nix @@ -0,0 +1,22 @@ +{ + identities, + primaryUser, + ... +}: +let + user = identities.users.${primaryUser}; +in +{ + programs.git = { + signing = { + # Will be available on remote machines via SSH agent (Secretive). + key = "key::" + user.sign."sign@mars".key; + signByDefault = true; + }; + + settings.user = { + name = "Artem Sheremet"; + inherit (user) email; + }; + }; +} diff --git a/legacy/.gitconfig b/legacy/.gitconfig deleted file mode 100644 index 1ffdf97..0000000 --- a/legacy/.gitconfig +++ /dev/null @@ -1,45 +0,0 @@ -[color] - ui = auto -[alias] - co = checkout - st = status - di = diff -w --no-prefix - df = diff - dc = diff --cached - ci = commit - br = branch - lg = log -p --decorate=full --show-signature - lol = log --graph --decorate=full --pretty=oneline --abbrev-commit - lola = log --graph --decorate=full --pretty=oneline --abbrev-commit --all - ls = ls-files - # Show files ignored by git: - ign = ls-files -o -i --exclude-standard -[apply] - whitespace = nowarn -[push] - default = tracking -[rebase] - stat = yes -[format] - pretty = fuller -[fetch] - prune = yes -[credential "https://source.developers.google.com"] - helper = gcloud.sh -[core] - autocrlf = input -[branch] - # 0 times I wanted this when doing "git checkout". - autoSetupMerge = false - # Set up new branches in a way that "git pull" does a rebase by default. - autoSetupRebase = always - -# Commit signing, currently using ssh@mars -- to be switched to sign@mars after 2026-05-15 -[gpg] - format = ssh -[commit] - gpgsign = true -[user] - signingkey = key::ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNwSX/Ib6kNzgRKqWfcb3HsAQQo++Gt9KeXSvP6NDk6YQPjDsi+//IiBovgLjQ34El+x8l8y3aYhfIGlCyX7aOM= sign@mars - name = Artem Sheremet - email = dot.doom@gmail.com diff --git a/modules/home/common.nix b/modules/home/common.nix index f25c892..c6e598e 100644 --- a/modules/home/common.nix +++ b/modules/home/common.nix @@ -19,6 +19,44 @@ fi ''; + programs.git = { + enable = true; + + settings = { + alias = { + co = "checkout"; + st = "status"; + di = "diff -w --no-prefix"; + df = "diff"; + dc = "diff --cached"; + ci = "commit"; + br = "branch"; + lg = "log -p --decorate=full --show-signature"; + lol = "log --graph --decorate=full --pretty=oneline --abbrev-commit"; + lola = "log --graph --decorate=full --pretty=oneline --abbrev-commit --all"; + ls = "ls-files"; + # Show files ignored by git: + ign = "ls-files -o -i --exclude-standard"; + }; + + color.ui = "auto"; + apply.whitespace = "nowarn"; + push.default = "tracking"; + rebase.stat = "yes"; + format.pretty = "fuller"; + fetch.prune = "yes"; + core.autocrlf = "input"; + branch = { + # 0 times I wanted this when doing "git checkout". + autoSetupMerge = false; + # Set up new branches in a way that "git pull" does a rebase by default. + autoSetupRebase = "always"; + }; + gpg.format = "ssh"; + credential."https://source.developers.google.com".helper = "gcloud.sh"; + }; + }; + programs.zsh = { enable = true; initContent = ''