From 326b14d39a9f1eebdfc6b9c609897a46e549d0f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sun, 7 May 2023 13:51:09 +0200 Subject: [PATCH] feat(lib): add listModules to import modules --- lib/default.nix | 2 ++ modules/config/default.nix | 11 +++------- modules/programs/default.nix | 34 +++--------------------------- modules/services/default.nix | 14 +++--------- modules/virtualisation/default.nix | 7 +++--- overlays/default.nix | 4 ++-- 6 files changed, 16 insertions(+), 56 deletions(-) diff --git a/lib/default.nix b/lib/default.nix index b66d67d..f7a8b1c 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -45,4 +45,6 @@ lib.makeExtensible (_: rec { lib.mapAttrs' mkModule modulesInDir; mapModules' = f: dir: lib.attrValues (mapModules f dir); + + listModules = mapModules' (path: path); }) diff --git a/modules/config/default.nix b/modules/config/default.nix index f2be122..1a044e4 100644 --- a/modules/config/default.nix +++ b/modules/config/default.nix @@ -1,10 +1,5 @@ +{ lib, ... }: + { - imports = [ - ./bin - ./nix.nix - ./shell.nix - ./theming - ./wallpapers.nix - ./yubikey.nix - ]; + imports = lib.my.listModules ./.; } diff --git a/modules/programs/default.nix b/modules/programs/default.nix index bf1d830..1a044e4 100644 --- a/modules/programs/default.nix +++ b/modules/programs/default.nix @@ -1,33 +1,5 @@ +{ lib, ... }: + { - imports = [ - ./adb.nix - ./bspwm - ./chromium.nix - ./code.nix - ./direnv.nix - ./firefox.nix - ./fish.nix - ./git.nix - ./gnome.nix - ./gpg.nix - ./helix.nix - ./hub.nix - ./hyprland - ./kakoune.nix - ./kitty.nix - ./ledger - ./logseq.nix - ./miracast.nix - ./navi - ./nvim - ./python.nix - ./rofi - ./spotify.nix - ./ssh.nix - ./sway.nix - ./thunar.nix - ./tmux.nix - ./zathura.nix - ./zsh.nix - ]; + imports = lib.my.listModules ./.; } diff --git a/modules/services/default.nix b/modules/services/default.nix index 9cadf62..1a044e4 100644 --- a/modules/services/default.nix +++ b/modules/services/default.nix @@ -1,13 +1,5 @@ +{ lib, ... }: + { - imports = [ - ./dunst.nix - ./gammastep.nix - ./kdeconnect.nix - ./mullvad.nix - ./openconnect.nix - ./picom.nix - ./printing.nix - ./synology-drive.nix - ./wireguard.nix - ]; + imports = lib.my.listModules ./.; } diff --git a/modules/virtualisation/default.nix b/modules/virtualisation/default.nix index bcc1863..1a044e4 100644 --- a/modules/virtualisation/default.nix +++ b/modules/virtualisation/default.nix @@ -1,6 +1,5 @@ +{ lib, ... }: + { - imports = [ - ./podman.nix - ./virtualisation.nix - ]; + imports = lib.my.listModules ./.; } diff --git a/overlays/default.nix b/overlays/default.nix index e3d2d4d..6713493 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,4 +1,4 @@ -{ inputs, lib }: +{ lib, ... }@args: lib.composeManyExtensions - (lib.my.mapModules' (file: import file { inherit inputs lib; }) ./.) + (lib.my.mapModules' (file: import file args) ./.)