diff --git a/lib/modules/git.nix b/lib/modules/git.nix index d7180844..dd3bd8fd 100644 --- a/lib/modules/git.nix +++ b/lib/modules/git.nix @@ -1,41 +1,7 @@ -{ lib, ... }: - let - inherit (lib) - mkOption - types - ; - - gitOptions = { - defaultBranch = mkOption { - type = types.nullOr types.str; - description = "The name of the default branch in git."; - default = null; - }; - - flow = { - mainBranch = mkOption { - type = types.nullOr types.str; - description = "The name of the stable branch in git flow."; - default = null; - }; - - devBranch = mkOption { - type = types.nullOr types.str; - description = "The name of the development branch in git flow."; - default = null; - }; - }; - - aliases = mkOption { - type = types.attrsOf types.str; - description = "Git command aliases to install."; - default = {}; - }; +{ lib, ... }: { + options = { + valhalla = { + git = (import ./git/options.nix) { inherit lib; }; }; - in { - options = { - valhalla = { - git = gitOptions; - }; - }; - } + }; +} diff --git a/lib/modules/git/options.nix b/lib/modules/git/options.nix new file mode 100644 index 00000000..e063e034 --- /dev/null +++ b/lib/modules/git/options.nix @@ -0,0 +1,33 @@ +{ lib, ... }: + let + inherit (lib) + mkOption + types + ; + in { + defaultBranch = mkOption { + type = types.nullOr types.str; + description = "The name of the default branch in git."; + default = null; + }; + + flow = { + mainBranch = mkOption { + type = types.nullOr types.str; + description = "The name of the stable branch in git flow."; + default = null; + }; + + devBranch = mkOption { + type = types.nullOr types.str; + description = "The name of the development branch in git flow."; + default = null; + }; + }; + + aliases = mkOption { + type = types.attrsOf types.str; + description = "Git command aliases to install."; + default = {}; + }; + } diff --git a/lib/modules/users.nix b/lib/modules/users.nix new file mode 100644 index 00000000..495bb576 --- /dev/null +++ b/lib/modules/users.nix @@ -0,0 +1,48 @@ +{ lib, ... }: + let + inherit (lib) + mkOption + types + ; + + userType = types.submodule ( + { ... }: { + options = { + displayName = mkOption { + type = types.nullOr types.str; + description = "The human-readable name of the user."; + default = null; + }; + + mailAddress = mkOption { + type = types.nullOr types.str; + description = "The mail address of the user."; + default = null; + }; + + groups = mkOption { + type = types.listOf types.str; + description = "The additional groups of the user."; + default = []; + }; + + defaultShell = mkOption { + type = types.nullOr types.str; + description = "The default shell of the user."; + default = null; + }; + + git = (import ./git/options.nix) { inherit lib; }; + }; + }); + in { + options = { + valhalla = { + users = mkOption { + type = types.attrsOf userType; + description = "The users to create on the machine."; + default = {}; + }; + }; + }; + } diff --git a/lib/modules/valhalla.nix b/lib/modules/valhalla.nix index e3e1ad14..88edf140 100644 --- a/lib/modules/valhalla.nix +++ b/lib/modules/valhalla.nix @@ -10,6 +10,7 @@ ./i18n.nix ./partition.nix ./software.nix + ./users.nix ]; options = { diff --git a/profiles/Generic/config.nix b/profiles/Generic/config.nix index ddfe9bb3..f30e47ad 100644 --- a/profiles/Generic/config.nix +++ b/profiles/Generic/config.nix @@ -35,6 +35,19 @@ }; }; + users = { + manuel = { + displayName = "Manuel Thalmann"; + mailAddress = "m@nuth.ch"; + groups = [ + "wheel" + "nix-users" + ]; + + defaultShell = "fish"; + }; + }; + timeZone = "Europe/Zurich"; keyMap = "de_CH-latin1"; keyboardLayout = "ch";