73 lines
1.4 KiB
Nix
73 lines
1.4 KiB
Nix
{
|
|
namespace,
|
|
lib,
|
|
config,
|
|
...
|
|
}:
|
|
let
|
|
inherit (lib)
|
|
mkOption
|
|
types
|
|
mkDefault
|
|
mkIf
|
|
;
|
|
in
|
|
{
|
|
options.${namespace}.my = rec {
|
|
name = mkOption {
|
|
type = types.str;
|
|
default = config.snowfallorg.user.name or "marley";
|
|
description = "Your username, for use as your login name.";
|
|
};
|
|
|
|
username = mkOption {
|
|
type = types.str;
|
|
default = name;
|
|
description = "Your username, for external profiles.";
|
|
};
|
|
|
|
fullName = mkOption {
|
|
type = types.str;
|
|
default = name;
|
|
description = "Your full name, for display purposes.";
|
|
};
|
|
|
|
email = mkOption {
|
|
type = types.NullOr types.str;
|
|
default = null;
|
|
description = "Your email";
|
|
};
|
|
|
|
git.name = mkOption {
|
|
type = types.str;
|
|
default = name;
|
|
description = "Your git committer name.";
|
|
};
|
|
|
|
git.email = mkOption {
|
|
type = types.nullOr types.str;
|
|
default = email;
|
|
description = "Your git committer email.";
|
|
};
|
|
};
|
|
|
|
config =
|
|
let
|
|
cfg = config.${namespace}.my;
|
|
in
|
|
{
|
|
assertions = [
|
|
{
|
|
assertion = cfg.name != null;
|
|
message = "${namespace}.my.name must be set.";
|
|
}
|
|
];
|
|
|
|
home.username = mkDefault cfg.name;
|
|
|
|
programs.git = mkIf config.programs.git.enable {
|
|
userName = mkDefault cfg.git.name;
|
|
userEmail = mkDefault cfg.git.email;
|
|
};
|
|
};
|
|
}
|