refactor: condensed the lists

This commit is contained in:
Nick 2024-11-03 20:50:41 -06:00
parent d369bfaa5c
commit 98795adb7d

View file

@ -1,53 +1,55 @@
let let
serviceModules = [
"services"
];
fileModules = [
"accounts"
"android"
"audio"
"bluetooth"
"corectrl"
"dconf"
"disks"
"doas"
"environment"
"firejail"
"flatpak"
"fonts"
"gnome"
"greetd"
"gvfs"
"home-manager"
"locale"
"network"
"nix"
"nur"
"ollama"
"plasma"
"printing"
"regreet"
"rsyncd"
"sddm"
"sops"
"ssh"
"steam"
"syncthing"
"sysstat"
"system"
"virtualization"
"xserver"
];
modulesPath = ./modules; modulesPath = ./modules;
importFolder = name: {"${name}" = import (modulesPath + "/${name}");}; importFolder = name: {"${name}" = import (modulesPath + "/${name}");};
importFile = name: {"${name}" = import (modulesPath + "/${name}.nix");}; importFile = name: {"${name}" = import (modulesPath + "/${name}.nix");};
modules = modules =
builtins.foldl' (a: b: a // b) {} (map importFolder serviceModules) builtins.foldl' (
// builtins.foldl' (a: b: a // b) {} (map importFile fileModules); emptySet: importedModules:
emptySet // importedModules
) {} (map importFolder [
"services"
])
// builtins.foldl' (
emptySet: importedModules:
emptySet // importedModules
) {} (map importFile [
"accounts"
"android"
"audio"
"bluetooth"
"corectrl"
"dconf"
"disks"
"doas"
"environment"
"firejail"
"flatpak"
"fonts"
"gnome"
"greetd"
"gvfs"
"home-manager"
"locale"
"network"
"nix"
"nur"
"ollama"
"plasma"
"printing"
"regreet"
"rsyncd"
"sddm"
"sops"
"ssh"
"steam"
"syncthing"
"sysstat"
"system"
"virtualization"
"xserver"
]);
in { in {
flake.nixosModules = { flake.nixosModules = {
personal = { personal = {
@ -74,7 +76,7 @@ in {
desktop = { desktop = {
imports = with modules; [ imports = with modules; [
syncthing syncthing
ollama # ollama
]; ];
}; };