2022-12-11 01:46:05 +00:00
|
|
|
{ config
|
|
|
|
, myLib
|
|
|
|
, ...
|
2022-12-11 00:00:49 +00:00
|
|
|
}:
|
2022-12-11 01:46:05 +00:00
|
|
|
let
|
|
|
|
cfg = config.base.git;
|
|
|
|
baseAliases = {
|
|
|
|
a = "add";
|
|
|
|
c = "commit";
|
|
|
|
ca = "commit --amend";
|
|
|
|
cm = "commit -m";
|
|
|
|
lol = "log --graph --decorate --pretty=oneline --abbrev-commit";
|
|
|
|
lola = "log --graph --decorate --pretty=oneline --abbrev-commit --all";
|
|
|
|
sts = "status";
|
|
|
|
co = "checkout";
|
|
|
|
b = "branch";
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.base.git = {
|
|
|
|
aliases = myLib.mkOption {
|
|
|
|
type = myLib.types.attrs;
|
|
|
|
default = { };
|
|
|
|
example = baseAliases;
|
|
|
|
description = ''
|
|
|
|
Additional git aliases. This settings comes with base configuration.
|
|
|
|
Redeclaring the base config will override the values.
|
|
|
|
''; # TODO: Add baseAliases as string here (builtins.toString doesn't work)
|
|
|
|
};
|
|
|
|
name = myLib.mkOption {
|
|
|
|
type = myLib.types.str;
|
|
|
|
default = "Pegasust";
|
|
|
|
description = "Git username that appears on commits";
|
|
|
|
example = "Pegasust";
|
|
|
|
};
|
|
|
|
email = myLib.mkOption {
|
|
|
|
type = myLib.types.str;
|
|
|
|
default = "pegasucksgg@gmail.com";
|
|
|
|
example = "peagsucksgg@gmail.com";
|
|
|
|
description = "Git email that appears on commits";
|
|
|
|
};
|
|
|
|
ignores = myLib.mkOption {
|
|
|
|
type = myLib.types.listOf myLib.types.str;
|
|
|
|
default = [
|
|
|
|
".vscode" # vscode settings
|
|
|
|
".direnv" # .envrc cached outputs
|
|
|
|
];
|
|
|
|
description = ''
|
|
|
|
.gitignore patterns that are applied in every repository.
|
|
|
|
This is useful for IDE-specific settings.
|
|
|
|
'';
|
|
|
|
example = [ ".direnv" "node_modules" ];
|
|
|
|
};
|
|
|
|
enable = myLib.mkOption {
|
|
|
|
type = myLib.types.bool;
|
|
|
|
default = true;
|
|
|
|
description = ''
|
|
|
|
Enables git
|
|
|
|
'';
|
|
|
|
example = false;
|
|
|
|
};
|
|
|
|
credentialCacheTimeoutSeconds = myLib.mkOption {
|
|
|
|
type = myLib.types.int;
|
|
|
|
default = 3000;
|
|
|
|
description = "Credential cache (in-memory store) for Git in seconds.";
|
|
|
|
example = 3000;
|
|
|
|
};
|
|
|
|
};
|
2023-01-13 06:42:21 +00:00
|
|
|
# TODO : anyway to override configuration?
|
2022-12-11 01:46:05 +00:00
|
|
|
config.programs.git = {
|
2023-01-13 06:42:21 +00:00
|
|
|
inherit (cfg) enable ignores;
|
2022-12-11 01:46:05 +00:00
|
|
|
userName = cfg.name;
|
|
|
|
userEmail = cfg.email;
|
|
|
|
aliases = baseAliases // cfg.aliases;
|
|
|
|
extraConfig = {
|
|
|
|
credential.helper = "cache --timeout=${builtins.toString cfg.credentialCacheTimeoutSeconds}";
|
|
|
|
};
|
|
|
|
lfs.enable = true;
|
|
|
|
};
|
|
|
|
}
|