From dbf6cd6337fe2d1fc765f8c80233f7d8570c14f9 Mon Sep 17 00:00:00 2001 From: niten Date: Wed, 6 Sep 2023 17:37:55 -0700 Subject: [PATCH] Add givenName & surname --- lib/types/user.nix | 159 ++++++++++++++++++++++++--------------------- 1 file changed, 85 insertions(+), 74 deletions(-) diff --git a/lib/types/user.nix b/lib/types/user.nix index e344e7b..7ddf5b8 100644 --- a/lib/types/user.nix +++ b/lib/types/user.nix @@ -1,7 +1,6 @@ { lib, ... }: -with lib; -rec { +with lib; rec { systemUserOpts = { name, ... }: { options = with lib.types; { username = mkOption { @@ -23,93 +22,105 @@ rec { }; }; - userOpts = { name, ... }: let - username = name; - in { - options = with lib.types; { - username = mkOption { - type = str; - description = "The user's login name."; - default = username; - }; + userOpts = { name, ... }: + let username = name; + in { + options = with lib.types; { + username = mkOption { + type = str; + description = "The user's login name."; + default = username; + }; - uid = mkOption { - type = int; - description = "Unique UID number for the user."; - }; + uid = mkOption { + type = int; + description = "Unique UID number for the user."; + }; - common-name = mkOption { - type = str; - description = "The user's common or given name."; - }; + common-name = mkOption { + type = str; + description = "The user's common or given name."; + }; - primary-group = mkOption { - type = str; - description = "Primary group to which the user belongs."; - }; + primary-group = mkOption { + type = str; + description = "Primary group to which the user belongs."; + }; - login-shell = mkOption { - type = nullOr shellPackage; - description = "The user's preferred shell."; - }; + login-shell = mkOption { + type = nullOr shellPackage; + description = "The user's preferred shell."; + }; - description = mkOption { - type = str; - default = "Fudo Member"; - description = "A description of this user's role."; - }; + description = mkOption { + type = str; + default = "Fudo Member"; + description = "A description of this user's role."; + }; - ldap-hashed-passwd = mkOption { - type = nullOr str; - description = - "LDAP-formatted hashed password, used for email and other services. Use slappasswd to generate the properly-formatted password."; - default = null; - }; + ldap-hashed-passwd = mkOption { + type = nullOr str; + description = + "LDAP-formatted hashed password, used for email and other services. Use slappasswd to generate the properly-formatted password."; + default = null; + }; - login-hashed-passwd = mkOption { - type = nullOr str; - description = - "Hashed password for shell, used for shell access to hosts. Use mkpasswd to generate the properly-formatted password."; - default = null; - }; + login-hashed-passwd = mkOption { + type = nullOr str; + description = + "Hashed password for shell, used for shell access to hosts. Use mkpasswd to generate the properly-formatted password."; + default = null; + }; - ssh-authorized-keys = mkOption { - type = listOf str; - description = "SSH public keys this user can use to log in."; - default = [ ]; - }; + ssh-authorized-keys = mkOption { + type = listOf str; + description = "SSH public keys this user can use to log in."; + default = [ ]; + }; - home-directory = mkOption { - type = nullOr str; - description = "Default home directory for the given user."; - default = null; - }; + home-directory = mkOption { + type = nullOr str; + description = "Default home directory for the given user."; + default = null; + }; - k5login = mkOption { - type = listOf str; - description = "List of Kerberos principals that map to this user."; - default = [ ]; - }; + k5login = mkOption { + type = listOf str; + description = "List of Kerberos principals that map to this user."; + default = [ ]; + }; - ssh-keys = mkOption { - type = listOf (submodule sshKeyOpts); - description = "Path to the user's public and private key files."; - default = []; - }; + ssh-keys = mkOption { + type = listOf (submodule sshKeyOpts); + description = "Path to the user's public and private key files."; + default = [ ]; + }; - email = mkOption { - type = nullOr str; - description = "User's primary email address."; - default = null; - }; + email = mkOption { + type = nullOr str; + description = "User's primary email address."; + default = null; + }; - email-aliases = mkOption { - type = listOf str; - description = "Email aliases that should map to this user."; - default = []; + email-aliases = mkOption { + type = listOf str; + description = "Email aliases that should map to this user."; + default = [ ]; + }; + + given-name = mkOption { + type = nullOr str; + description = "User's given name."; + default = null; + }; + + surname = mkOption { + type = nullOr str; + description = "User's surname."; + default = null; + }; }; }; - }; groupOpts = { name, ... }: { options = with lib.types; {