diff --git a/modules/darwin/user/default.nix b/modules/darwin/user/default.nix index a9058ee..a0303d6 100644 --- a/modules/darwin/user/default.nix +++ b/modules/darwin/user/default.nix @@ -6,14 +6,22 @@ inputs, ... }: let - inherit (lib) types mkOption mkDefault foldl optionalAttrs; + inherit + (lib) + types + mkOption + mkDefault + mkRenamedOptionModule + foldl + optionalAttrs + ; cfg = config.snowfallorg; - user-names = builtins.attrNames cfg.user; + user-names = builtins.attrNames cfg.users; create-system-users = system-users: name: let - user = cfg.user.${name}; + user = cfg.users.${name}; in system-users // (optionalAttrs user.create { @@ -23,8 +31,12 @@ }; }); in { + imports = [ + (mkRenamedOptionModule ["snowfallorg" "user"] ["snowfallorg" "users"]) + ]; + options.snowfallorg = { - user = mkOption { + users = mkOption { description = "User configuration."; default = {}; type = types.attrsOf (types.submodule ({name, ...}: { diff --git a/modules/nixos/user/default.nix b/modules/nixos/user/default.nix index 9e11060..b19d155 100644 --- a/modules/nixos/user/default.nix +++ b/modules/nixos/user/default.nix @@ -5,16 +5,25 @@ args @ { config, ... }: let - inherit (lib) types mkOption mkDefault foldl optionalAttrs optional; + inherit + (lib) + types + mkOption + mkDefault + mkRenamedOptionModule + foldl + optionalAttrs + optional + ; cfg = config.snowfallorg; inputs = args.inputs or {}; - user-names = builtins.attrNames cfg.user; + user-names = builtins.attrNames cfg.users; create-system-users = system-users: name: let - user = cfg.user.${name}; + user = cfg.users.${name}; in system-users // (optionalAttrs user.create { @@ -30,8 +39,12 @@ args @ { }; }); in { + imports = [ + (mkRenamedOptionModule ["snowfallorg" "user"] ["snowfallorg" "users"]) + ]; + options.snowfallorg = { - user = mkOption { + users = mkOption { description = "User configuration."; default = {}; type = types.attrsOf (types.submodule ({name, ...}: { diff --git a/snowfall-lib/home/default.nix b/snowfall-lib/home/default.nix index 23a9957..314c022 100644 --- a/snowfall-lib/home/default.nix +++ b/snowfall-lib/home/default.nix @@ -318,7 +318,7 @@ in { (builtins.trace '' ============= Snowfall Lib: - Option value for `snowfallorg.user.${user-name}` was not detected to be merged. + Option value for `snowfallorg.users.${user-name}` was not detected to be merged. Please report the issue on GitHub with a link to your configuration so we can debug the problem: https://github.com/snowfallorg/lib/issues/new @@ -326,13 +326,13 @@ in { '') user-option; - home-config = mkAliasAndWrapDefinitions wrap-user-options options.snowfallorg.user; + home-config = mkAliasAndWrapDefinitions wrap-user-options options.snowfallorg.users; in { _file = "virtual:snowfallorg/home/user/${name}"; config = mkIf host-matches { # Initialize user information. - snowfallorg.user.${user-name}.home.config = { + snowfallorg.users.${user-name}.home.config = { snowfallorg.user = { enable = mkDefault true; name = mkDefault user-name; @@ -346,9 +346,9 @@ in { }; home-manager = { - users.${user-name} = mkIf config.snowfallorg.user.${user-name}.home.enable ({pkgs, ...}: { + users.${user-name} = mkIf config.snowfallorg.users.${user-name}.home.enable ({pkgs, ...}: { imports = (home-config.imports or []) ++ other-modules ++ [user-module]; - config = home-config; + config = builtins.removeAttrs home-config ["imports"]; }); # NOTE: Without this home-manager will instead create its own package set which won't contain the same config and