From c3a79aa8dc85bedd9b418bcbc47b113af61d591e Mon Sep 17 00:00:00 2001 From: serenity-F Date: Tue, 29 Sep 2026 00:54:15 +1000 Subject: [PATCH] twea: added 2nd multi-user enabling module to study --- modules/system/user-parts2.nix | 69 ++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 modules/system/user-parts2.nix diff --git a/modules/system/user-parts2.nix b/modules/system/user-parts2.nix new file mode 100644 index 0000000..b908aa3 --- /dev/null +++ b/modules/system/user-parts2.nix @@ -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}"; + }; + }; + }; +}