marleyos/modules/home/options/my/default.nix

61 lines
1.3 KiB
Nix

{
lib,
config,
...
}: {
options.marleyos.my = rec {
name = lib.mkOption {
type = with lib.types; str;
default = config.snowfallorg.user.name or "marley";
description = "Your username, for use as your login name.";
};
username = lib.mkOption {
type = with lib.types; str;
default = name;
description = "Your username, for external profiles.";
};
fullName = lib.mkOption {
type = with lib.types; str;
default = name;
description = "Your full name, for display purposes.";
};
email = lib.mkOption {
type = with lib.types; nullOr str;
default = null;
description = "Your email";
};
git.name = lib.mkOption {
type = with lib.types; str;
default = username;
description = "Your git committer name.";
};
git.email = lib.mkOption {
type = with lib.types; nullOr str;
default = email;
description = "Your git committer email.";
};
};
config = let
cfg = config.marleyos.my;
in {
assertions = [
{
assertion = cfg.name != null;
message = "marleyos.my.name must be set.";
}
];
home.username = lib.mkDefault cfg.name;
programs.git = {
userName = lib.mkDefault cfg.git.name;
userEmail = lib.mkDefault cfg.git.email;
};
};
}