nixos-config/home/git.nix

56 lines
1.7 KiB
Nix
Raw Normal View History

2020-08-15 03:06:37 +02:00
{ config, pkgs, ... }:
2020-03-13 21:18:08 +01:00
{
programs.git = {
enable = true;
2022-05-13 12:06:04 +02:00
lfs.enable = true;
2020-08-15 03:06:37 +02:00
profiles = {
private = {
name = "Felix Schröter";
2020-09-23 13:19:19 +02:00
email = "dev@felschr.com";
2022-01-20 17:00:17 +01:00
# use sign subkey's fingerprint: gpg2 -K --with-subkey-fingerprint
signingKey = "7E08 6842 0934 AA1D 6821 1F2A 671E 39E6 744C 807D";
2024-05-26 16:45:38 +02:00
dirs = [
"~/dev/private/"
"/etc/nixos/"
2024-05-26 16:45:38 +02:00
];
2020-08-15 00:10:53 +02:00
};
2020-08-15 03:06:37 +02:00
work = {
2020-09-23 13:19:19 +02:00
name = "Felix Schröter";
2025-05-02 14:56:10 +02:00
email = "felix.schroeter@cmdscale.com";
2022-01-20 17:00:17 +01:00
# use sign subkey's fingerprint: gpg2 -K --with-subkey-fingerprint
2025-05-02 14:56:10 +02:00
signingKey = "5A9D CC6B F70A C69B B0D7 C755 A3A2 2573 CA6D 0E38";
2020-09-23 13:19:19 +02:00
dirs = [ "~/dev/work/" ];
2020-03-13 21:18:08 +01:00
};
};
2020-09-23 13:19:19 +02:00
ignores = [ ".direnv" ];
2024-05-26 16:45:38 +02:00
signing = {
signByDefault = true;
};
2025-12-09 22:41:14 +01:00
settings = {
2024-05-26 16:45:38 +02:00
init = {
defaultBranch = "main";
};
pull = {
rebase = true;
};
rebase = {
autoStash = true;
autoSquash = true;
abbreviateCommands = true;
missingCommitsCheck = "warn";
};
2025-12-09 22:41:14 +01:00
alias = {
# usage: git mr <source> <MR number> (git mr origin 1010)
mr = "!sh -c 'git fetch $1 merge-requests/$2/head:mr-$1-$2 && git checkout mr-$1-$2' -";
# usage: git pr <source> <PR number> (git pr origin 1010)
pr = "!sh -c 'git fetch $1 pull/$2/head:pr/$2 && git checkout pr/$2' -";
# delete branches locally that have already been merged
# usage: git clean-branches <branch> (branch to check against, defaults to main)
clean-branches = ''!sh -c 'git branch --merged "''${1:-main}" | egrep -v "(^\*|master|main|staging|production)" | xargs git branch -d' -'';
};
};
2020-03-13 21:18:08 +01:00
};
}