34 lines
792 B
Nix
34 lines
792 B
Nix
{ lib, ... }:
|
|
let
|
|
inherit (lib) mkOption stringLength;
|
|
inherit (lib.types) str strMatching nullOr;
|
|
|
|
validateUserName =
|
|
x:
|
|
assert (
|
|
stringLength x < 32 || abort "Username '${x}' is longer than 31 characters which is not allowed!"
|
|
);
|
|
x;
|
|
in
|
|
{
|
|
options.modules.meta = {
|
|
hostname = mkOption {
|
|
type = strMatching "^[[:alnum:]]([[:alnum:]_-]{0,61}[[:alnum:]])?$";
|
|
default = "";
|
|
description = "The system's hostname.";
|
|
};
|
|
username = mkOption {
|
|
default = "";
|
|
type = str;
|
|
apply = validateUserName;
|
|
# Should handle multiple users one day? maybe...
|
|
description = "This system's primary user.";
|
|
};
|
|
tailscale = {
|
|
ip = mkOption {
|
|
default = null;
|
|
type = nullOr str;
|
|
};
|
|
};
|
|
};
|
|
}
|