punkfairie
e4facfab9a
Don't need to check if the module is enabled for settings within that module.... they won't be applied if it's not enabled by default
72 lines
1.4 KiB
Nix
72 lines
1.4 KiB
Nix
{
|
|
lib,
|
|
config,
|
|
...
|
|
}:
|
|
let
|
|
inherit (lib)
|
|
mkOption
|
|
types
|
|
mkDefault
|
|
mkIf
|
|
;
|
|
in
|
|
{
|
|
options.marleyos.my = rec {
|
|
name = mkOption {
|
|
type = with types; str;
|
|
default = config.snowfallorg.user.name or "marley";
|
|
description = "Your username, for use as your login name.";
|
|
};
|
|
|
|
username = mkOption {
|
|
type = with types; str;
|
|
default = name;
|
|
description = "Your username, for external profiles.";
|
|
};
|
|
|
|
fullName = mkOption {
|
|
type = with types; str;
|
|
default = name;
|
|
description = "Your full name, for display purposes.";
|
|
};
|
|
|
|
email = mkOption {
|
|
type = with types; nullOr str;
|
|
default = null;
|
|
description = "Your email";
|
|
};
|
|
|
|
git.name = mkOption {
|
|
type = with types; str;
|
|
default = username;
|
|
description = "Your git committer name.";
|
|
};
|
|
|
|
git.email = mkOption {
|
|
type = with 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 = mkDefault cfg.name;
|
|
|
|
programs.git = {
|
|
userName = mkDefault cfg.git.name;
|
|
userEmail = mkDefault cfg.git.email;
|
|
};
|
|
};
|
|
}
|