feat(git): add enable option

This commit is contained in:
2026-05-22 10:57:51 +02:00
parent 1255083ad6
commit 6c9bbc27a0
5 changed files with 31 additions and 23 deletions

View File

@@ -1,29 +1,31 @@
{
config,
...
}:
{ lib, config, ... }:
let
cfg = config.git;
inherit (config.host) username;
owner = config.users.users.${username}.name;
in
{
config.sops.templates = {
".gitconfig.email" = {
inherit owner;
path = "/home/${username}/.gitconfig.email";
content = ''
[user]
email = ${config.sops.placeholder."email/personal"}
'';
};
".gitconfig.work.email" = {
inherit owner;
path = "/home/${username}/.gitconfig.work.email";
content = ''
[user]
email = ${config.sops.placeholder."email/work"}
'';
options.git.enable = lib.mkEnableOption "git";
config = lib.mkIf cfg.enable {
sops.templates = {
".gitconfig.email" = {
inherit owner;
path = "/home/${username}/.gitconfig.email";
content = ''
[user]
email = ${config.sops.placeholder."email/personal"}
'';
};
".gitconfig.work.email" = {
inherit owner;
path = "/home/${username}/.gitconfig.work.email";
content = ''
[user]
email = ${config.sops.placeholder."email/work"}
'';
};
};
};
}