From 326e1abca1a97e65b5f277db0a10c5a0f761b5a8 Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Thu, 5 Oct 2023 22:34:15 +0200 Subject: [PATCH] pinwheel: Dynamically read modules to import --- hosts/pinwheel/modules/default.nix | 41 +++++------------------------- 1 file changed, 6 insertions(+), 35 deletions(-) diff --git a/hosts/pinwheel/modules/default.nix b/hosts/pinwheel/modules/default.nix index 709a65e..4f74ef5 100644 --- a/hosts/pinwheel/modules/default.nix +++ b/hosts/pinwheel/modules/default.nix @@ -1,37 +1,8 @@ +{ lib, ... }: +let + toModulePath = dir: _: ./. + "/${dir}"; + filterDirs = dirs: lib.attrsets.filterAttrs (_: type: type == "directory") dirs; +in { - imports = [ - ./light - ./sound - ./keyboard - ./age - ./ssh - ./git - ./zsh - ./tmux - ./vim - ./emacs - ./foot - ./hyprland - ./waybar - ./swaylock - ./dunst - ./bemenu - ./screenshot - ./fzf - ./syncthing - ./firefox - ./mullvad - ./openvpn - ./calibre - ./go - ./nix - ./javascript - ./spotify - ./docker - ./podman - ./k8s - ./scripts - - ./work - ]; + imports = lib.mapAttrsToList toModulePath (filterDirs (builtins.readDir ./.)); }