2023-05-08 21:41:02 +00:00
|
|
|
{ lib, pkgs, ... }:
|
2022-11-22 05:28:41 +00:00
|
|
|
|
2023-01-27 07:55:38 +00:00
|
|
|
let
|
2023-07-10 06:07:47 +00:00
|
|
|
# TODO: use formats.gitIni or lib.generators.toGitINI
|
|
|
|
# - see: <repo:nixos/nixpkgs:pkgs/pkgs-lib/formats.nix>
|
2023-01-27 07:55:38 +00:00
|
|
|
mkCfg = lib.generators.toINI { };
|
|
|
|
in
|
2022-10-21 15:41:28 +00:00
|
|
|
{
|
2024-01-28 10:36:19 +00:00
|
|
|
sane.programs.git = {
|
2024-02-16 03:16:46 +00:00
|
|
|
packageUnwrapped = (pkgs.git.override {
|
|
|
|
# build without gitweb support, as that installs to share/git,
|
|
|
|
# which causes trouble trying to make the sandboxer
|
|
|
|
perlSupport = false;
|
|
|
|
}).overrideAttrs (upstream: {
|
|
|
|
postInstall = upstream.postInstall + ''
|
|
|
|
# git-jump is a symlink from bin/git-jump -> share/contrib/git-jump,
|
|
|
|
# which causes trouble trying to make the sandboxer
|
|
|
|
rm "$out/bin/git-jump"
|
|
|
|
'';
|
|
|
|
});
|
2024-01-28 10:36:19 +00:00
|
|
|
sandbox.method = "bwrap";
|
2024-02-08 21:51:32 +00:00
|
|
|
sandbox.net = "clearnet";
|
2024-01-28 10:36:19 +00:00
|
|
|
sandbox.whitelistPwd = true;
|
2024-01-29 09:57:27 +00:00
|
|
|
sandbox.autodetectCliPaths = true; # necessary for git-upload-pack
|
2024-01-28 10:36:19 +00:00
|
|
|
sandbox.extraHomePaths = [
|
|
|
|
# even with `whitelistPwd`, git has to crawl *up* the path -- which isn't necessarily in the sandbox -- to locate parent .git files
|
|
|
|
"dev"
|
2024-01-31 21:17:48 +00:00
|
|
|
"knowledge"
|
|
|
|
"nixos"
|
2024-01-28 10:36:19 +00:00
|
|
|
"ref"
|
2024-02-23 06:43:27 +00:00
|
|
|
".ssh/id_ed25519" # for ssh-auth'd remotes
|
2024-01-28 10:36:19 +00:00
|
|
|
];
|
|
|
|
fs.".config/git/config".symlink.text = mkCfg {
|
|
|
|
# top-level options documented:
|
|
|
|
# - <https://git-scm.com/docs/git-config#_variables>
|
2023-05-17 00:26:04 +00:00
|
|
|
|
2024-01-28 10:36:19 +00:00
|
|
|
user.name = "Colin";
|
|
|
|
user.email = "colin@uninsane.org";
|
2023-05-17 00:26:04 +00:00
|
|
|
|
2024-01-28 10:36:19 +00:00
|
|
|
alias.amend = "commit --amend --no-edit";
|
|
|
|
alias.br = "branch";
|
|
|
|
alias.co = "checkout";
|
|
|
|
alias.cp = "cherry-pick";
|
|
|
|
alias.d = "difftool";
|
|
|
|
alias.dif = "diff"; # common typo
|
|
|
|
alias.difsum = "diff --compact-summary"; #< show only the list of files which changed, not contents
|
|
|
|
alias.rb = "rebase";
|
|
|
|
alias.st = "status";
|
|
|
|
alias.stat = "status";
|
2023-05-17 00:26:04 +00:00
|
|
|
|
2024-01-28 10:36:19 +00:00
|
|
|
diff.noprefix = true; #< don't show a/ or b/ prefixes in diffs
|
|
|
|
# difftastic docs:
|
|
|
|
# - <https://difftastic.wilfred.me.uk/git.html>
|
|
|
|
diff.tool = "difftastic";
|
|
|
|
difftool.prompt = false;
|
|
|
|
"difftool \"difftastic\"".cmd = ''${pkgs.difftastic}/bin/difft "$LOCAL" "$REMOTE"'';
|
|
|
|
# now run `git difftool` to use difftastic git
|
2023-05-17 00:26:04 +00:00
|
|
|
|
2024-01-28 10:36:19 +00:00
|
|
|
# render dates as YYYY-MM-DD HH:MM:SS +TZ
|
|
|
|
log.date = "iso";
|
2023-06-25 21:45:47 +00:00
|
|
|
|
2024-01-28 10:36:19 +00:00
|
|
|
sendemail.annotate = "yes";
|
|
|
|
sendemail.confirm = "always";
|
2023-07-01 00:55:43 +00:00
|
|
|
|
2024-01-28 10:36:19 +00:00
|
|
|
stash.showPatch = true;
|
|
|
|
};
|
2023-05-08 21:41:02 +00:00
|
|
|
};
|
2022-10-21 15:41:28 +00:00
|
|
|
}
|