feat: Enable system flake additions from external files

This commit is contained in:
2025-12-09 18:43:05 -05:00
committed by Hunter Halloran
parent b950e6b8ae
commit cbb5a72ca4
5 changed files with 126 additions and 31 deletions

View File

@@ -3,7 +3,7 @@ let
userSubmodule = lib.types.submodule {
options = {
isNormalUser = lib.mkOption { type = lib.types.bool; default = true; };
description = lib.mkOption { type = lib.types.nullOr lib.types.str; default = null; };
description = lib.mkOption { type = lib.types.str; default = ""; };
extraGroups = lib.mkOption { type = lib.types.listOf lib.types.str; default = []; };
hashedPassword = lib.mkOption { type = lib.types.str; default = "!"; };
extraPackages = lib.mkOption { type = lib.types.listOf lib.types.package; default = []; };
@@ -49,9 +49,7 @@ in
finalPackages = lib.subtractLists user.excludePackages (defaultPackages ++ user.extraPackages);
in
{
inherit (user) isNormalUser extraGroups hashedPassword;
description = if user.description != null then user.description else lib.mkDefault "";
openssh.authorizedKeys.keys = user.opensshKeys;
inherit (user) isNormalUser description extraGroups hashedPassword;
packages = finalPackages;
shell = config.modules.users.shell;
}
@@ -68,7 +66,7 @@ in
enabledAccounts = lib.filterAttrs (name: _: lib.elem name config.modules.users.enabledUsers) config.modules.users.accounts;
in
lib.mapAttrs (name: user: { ... }: {
imports = user.extraImports ++
imports = user.extraImports ++ [ ../sw/theme.nix ../sw/nvim.nix ] ++
(lib.optional (user.flakeUrl != "") (builtins.getFlake user.flakeUrl).homeManagerModules.default);
home.username = name;
home.homeDirectory = if name == "root" then "/root" else "/home/${name}";