nixos-config/home/git.nix

49 lines
1.6 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";
2020-09-23 13:19:19 +02:00
dirs = [ "~/dev/private/" "/etc/nixos" ];
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";
email = "fs@upsquared.com";
2022-01-20 17:00:17 +01:00
# use sign subkey's fingerprint: gpg2 -K --with-subkey-fingerprint
signingKey = "16F6 4623 8B1C 80C4 6267 6FF9 4D13 24C5 006E 9B2E";
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" ];
signing = { signByDefault = true; };
extraConfig = {
2020-09-23 13:19:19 +02:00
init = { defaultBranch = "main"; };
pull = { rebase = true; };
rebase = {
autoStash = true;
autoSquash = true;
abbreviateCommands = true;
missingCommitsCheck = "warn";
};
};
aliases = {
2023-01-06 20:05:21 +01:00
# usage: git mr <source> <MR number> (git mr origin 1010)
2020-09-23 13:19:19 +02:00
mr =
"!sh -c 'git fetch $1 merge-requests/$2/head:mr-$1-$2 && git checkout mr-$1-$2' -";
2023-01-06 20:05:21 +01:00
# 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' -";
2023-05-31 16:58:38 +02:00
# 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
};
}