twea: added 2nd multi-user enabling module to study
This commit is contained in:
parent
28d38c0967
commit
c3a79aa8dc
1 changed files with 69 additions and 0 deletions
69
modules/system/user-parts2.nix
Normal file
69
modules/system/user-parts2.nix
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
{ self, inputs, ... }:
|
||||
|
||||
{
|
||||
|
||||
flake.nixosModules.variables =
|
||||
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
options.nixos.variables = {
|
||||
user = lib.mkOption {
|
||||
type = lib.types.submodule {
|
||||
options = {
|
||||
username = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "user";
|
||||
};
|
||||
default-shell = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = pkgs.nushell;
|
||||
defaultText = lib.literalExpression "pkgs.nushell";
|
||||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
};
|
||||
|
||||
git = lib.mkOption {
|
||||
type = lib.types.submodule {
|
||||
options = {
|
||||
username = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "DontBlameMe";
|
||||
};
|
||||
email = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "dontblameme@noreply.codeberg.org";
|
||||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
};
|
||||
|
||||
home-directory = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
};
|
||||
|
||||
default-locale = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "en_US.UTF-8";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = {
|
||||
# Make `nixos-variables` available as a module argument to all NixOS
|
||||
# modules (home-manager modules already get it via extraSpecialArgs).
|
||||
_module.args.nixos-variables = config.nixos.variables;
|
||||
nixos.variables = {
|
||||
home-directory = lib.mkDefault "/home/${config.nixos.variables.user.username}";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue