refactor: git.nix

This commit is contained in:
winston 2023-07-10 05:15:10 +02:00
parent 9a1c4661c3
commit a8b40fadac
Signed by: winston
GPG key ID: 3786770EDBC2B481

View file

@ -2,9 +2,7 @@
config,
pkgs,
...
}: let
inherit (pkgs.stdenv.hostPlatform) isDarwin;
in {
}: {
sops.secrets."gitconfig-work".path = "${config.xdg.configHome}/git/gitconfig-work";
programs.git.includes = [
{
@ -31,7 +29,7 @@ in {
gzip = "!git archive --format=tar.gz --output=$(basename $(git rev-parse --show-toplevel)).tar.gz $(git rev-parse --short HEAD)";
zip = "!git archive --format=zip --output=$(basename $(git rev-parse --show-toplevel)).zip $(git rev-parse --short HEAD)";
# for those 3am commits
yolo = "!git commit -m \"chore: $(curl -s whatthecommit.com/index.txt)\"";
yolo = "!git commit -m \"chore: $(curl -s https://whatthecommit.com/index.txt)\"";
};
lfs.enable = true;
@ -51,10 +49,7 @@ in {
];
# disable the macOS keychain, only use gopass
package =
if isDarwin
then (pkgs.git.override {osxkeychainSupport = false;})
else pkgs.git;
package = pkgs.git.override {osxkeychainSupport = false;};
extraConfig = {
credential.helper = "gopass";
@ -63,10 +58,10 @@ in {
push.gpgSign = "if-asked";
rebase.autosquash = true;
url = {
"https://github.com/".insteadOf = "github:";
"https://github.com/catppuccin/".insteadOf = "catppuccin:";
"https://github.com/nekowinston/".insteadOf = "nekowinston:";
"https://gitlab.com/".insteadOf = "gitlab:";
"https://github.com/".insteadOf = "gh:";
"https://github.com/catppuccin/".insteadOf = "ctp:";
"https://github.com/nekowinston/".insteadOf = "winston:";
"https://gitlab.com/".insteadOf = "gl:";
};
};
};