{ config, config', lib, ... }: with lib; let cfg = config.myOptions.programs.git; in { options.myOptions.programs.git = { enable = mkEnableOption "git"; userName = mkOption { type = types.str; description = "git username"; }; userEmail = mkOption { type = types.str; description = "git email"; }; signingKey = mkOption { type = types.str; description = "git commit signing key"; }; editor = mkOption { type = types.str; default = "nvim"; description = "commit message editor"; }; defaultBranch = mkOption { type = types.str; default = "main"; description = "default git branch"; }; }; config = mkIf cfg.enable { home-manager.users.${config'.username} = { programs.git = { inherit (cfg) enable userName userEmail; signing = { key = cfg.signingKey; signByDefault = true; }; includes = [ { contents = { core.editor = cfg.editor; }; } { contents = { init.defaultBranch = cfg.defaultBranch; }; } { contents = { push.autoSetupRemote = true; }; } ]; }; }; }; }