{ osConfig, lib, pkgs, ... }:
let
    hasGui = osConfig.services.dbus.implementation == "dbus";
in
{
    home.packages = with pkgs; lib.mkIf hasGui [
        git-credential-manager
    ];

    programs.git = {
        enable = true;
        package = pkgs.gitMinimal;
        lfs.enable = true;

        settings = {
            user.name = "Ghostfox";

            init.defaultBranch = "main";
            
            credential = {
                helper = if hasGui then "manager" else "store";
                credentialStore = lib.mkIf hasGui "secretservice";
                
                "https://github.com" = {
                    username = "kpghostfox";
                    email = "kpghostfox@int.pl";
                };

                "https://hazzy.nonamesoft.xyz" = {
                    username = "ghostfox";
                    email = "ghostfox@laminax.local";
                };
            };
        };
    };
}
