Regenerated
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
{ lib, config, inputs, ... }:
|
||||
|
||||
let
|
||||
# Default user
|
||||
username = config.defaultUser or "henrov";
|
||||
|
||||
# Path to modules and config
|
||||
modulesPath = ./generated/modules;
|
||||
moduleSwitches = builtins.fromJSON (builtins.readFile ./assets/system/conf/modules.json);
|
||||
|
||||
# Import all modules recursively
|
||||
importedModules = inputs.import-tree modulesPath;
|
||||
|
||||
# Only enabled modules (according to modules.json)
|
||||
enabledModules =
|
||||
lib.filterAttrs (name: _: moduleSwitches.${name} or false)
|
||||
importedModules.imports;
|
||||
|
||||
# Flatten enabled modules to a list
|
||||
moduleList = builtins.attrValues enabledModules;
|
||||
|
||||
# Debug info / list of imported module files
|
||||
importedFiles = map (m:
|
||||
if builtins.hasAttr "file" m then m.file else "unknown"
|
||||
) moduleList;
|
||||
|
||||
# Extract and force each homeManagerExtraUserFragment to attrset
|
||||
fragmentsPerModule = map (m:
|
||||
if builtins.hasAttr "homeManagerExtraUserFragment" m
|
||||
then m.homeManagerExtraUserFragment
|
||||
else {}
|
||||
) moduleList;
|
||||
|
||||
# Merge all fragments per username (top-level keys are usernames)
|
||||
mergedUserFragments = lib.foldl' lib.mkMerge {} fragmentsPerModule;
|
||||
|
||||
in {
|
||||
networking.hostName = "traveldroid";
|
||||
system.stateVersion = "26.05";
|
||||
|
||||
# Pass the merged fragments directly to home-manager
|
||||
home-manager.users = mergedUserFragments;
|
||||
|
||||
# Bonus debug info: list of imported modules
|
||||
debug.importedFiles = importedFiles;
|
||||
}
|
||||
Reference in New Issue
Block a user