nixos-configs/common/home/git/default.nix

79 lines
1.7 KiB
Nix
Raw Normal View History

{
pkgs,
self,
...
2024-06-23 13:21:02 -04:00
}: let
mkRemoteConf = remote: email: name: {
condition = "hasconfig:remote.*.url:${remote}:*/**";
contents.user = {inherit email name;};
};
mkDefaultRemote = remote: mkRemoteConf remote "matt@nelim.org" "matt1432";
in {
2023-10-15 16:41:34 -04:00
programs = {
git = {
enable = true;
2024-08-10 21:53:54 -04:00
package = pkgs.gitFull;
2023-10-15 16:41:34 -04:00
lfs.enable = true;
includes = [
2024-06-10 22:57:20 -04:00
{path = toString self.legacyPackages.${pkgs.system}.dracula.git;}
2024-06-23 13:21:02 -04:00
(mkDefaultRemote "https://github.com")
(mkDefaultRemote "git@github.com")
(mkDefaultRemote "git@git.nelim.org")
2024-06-23 13:21:02 -04:00
(mkRemoteConf "git@gitlab.info.uqam.ca" "gj591944@ens.uqam.ca" "Mathis Hurtubise")
2023-10-15 16:41:34 -04:00
];
delta = {
enable = true;
options = {
side-by-side = true;
2024-08-10 21:53:54 -04:00
line-numbers-zero-style = "#E6EDF3";
};
};
2024-03-01 01:34:59 -05:00
extraConfig = {
diff.sopsdiffer.textconv = "sops --config /dev/null -d";
# https://github.com/dandavison/delta/issues/630#issuecomment-860046929
pager = let
cmd = "LESS='LRc --mouse' ${pkgs.delta}/bin/delta";
in {
diff = cmd;
show = cmd;
stash = cmd;
log = cmd;
reflog = cmd;
};
2024-08-10 21:53:54 -04:00
sendemail = {
smtpserver = "127.0.0.1";
smtpuser = "matt@nelim.org";
smtpencryption = "tls";
smtpserverport = 1025;
smtpsslcertpath = "";
};
};
2023-10-15 16:41:34 -04:00
};
};
home.packages = with pkgs; [
(writeShellApplication {
name = "chore";
runtimeInputs = [git];
text = ''
DIR=''${1:-"$FLAKE"}
cd "$DIR" || exit 1
git add flake.lock
git commit -m 'chore: update flake.lock'
git push
'';
})
];
2023-10-15 16:41:34 -04:00
}