From 5c66afb75e313a8f0e1ccafde657c4813f0c9b1f Mon Sep 17 00:00:00 2001 From: Yusuf Bera Ertan Date: Sun, 14 Aug 2022 06:17:15 +0300 Subject: [PATCH] wolumonde: refactor module importing --- flake.nix | 2 +- hosts/wolumonde/default.nix | 17 ++++------------- hosts/wolumonde/{ => modules}/bernbot.nix | 0 hosts/wolumonde/{ => modules}/blog.nix | 0 hosts/wolumonde/{ => modules}/gitea.nix | 0 .../{ => modules}/hardware-configuration.nix | 0 hosts/wolumonde/{ => modules}/nginx.nix | 0 hosts/wolumonde/{ => modules}/nixinate.nix | 0 hosts/wolumonde/{ => modules}/ssh.nix | 0 9 files changed, 5 insertions(+), 14 deletions(-) rename hosts/wolumonde/{ => modules}/bernbot.nix (100%) rename hosts/wolumonde/{ => modules}/blog.nix (100%) rename hosts/wolumonde/{ => modules}/gitea.nix (100%) rename hosts/wolumonde/{ => modules}/hardware-configuration.nix (100%) rename hosts/wolumonde/{ => modules}/nginx.nix (100%) rename hosts/wolumonde/{ => modules}/nixinate.nix (100%) rename hosts/wolumonde/{ => modules}/ssh.nix (100%) diff --git a/flake.nix b/flake.nix index c56436c..ba5e01f 100644 --- a/flake.nix +++ b/flake.nix @@ -56,7 +56,7 @@ } ) allPkgs; - in rec { + in { nixosConfigurations = import ./hosts {inherit lib tlib inputs;}; packages = lib.mapAttrs (_: pkgs: pkgs._exported) allPkgs; diff --git a/hosts/wolumonde/default.nix b/hosts/wolumonde/default.nix index bd732e5..6c7bec3 100644 --- a/hosts/wolumonde/default.nix +++ b/hosts/wolumonde/default.nix @@ -6,20 +6,11 @@ ... }: { imports = let - files = - lib.filterAttrs - (name: type: type == "regular" && name != "default.nix") - (builtins.readDir (toString ./.)); + b = builtins; + modules = toString ./modules; + files = b.readDir modules; filesToImport = - builtins.map - ( - name: - builtins.path { - inherit name; - path = "${toString ./.}/${name}"; - } - ) - (builtins.attrNames files); + b.map (name: "${modules}/${name}") (b.attrNames files); in filesToImport; diff --git a/hosts/wolumonde/bernbot.nix b/hosts/wolumonde/modules/bernbot.nix similarity index 100% rename from hosts/wolumonde/bernbot.nix rename to hosts/wolumonde/modules/bernbot.nix diff --git a/hosts/wolumonde/blog.nix b/hosts/wolumonde/modules/blog.nix similarity index 100% rename from hosts/wolumonde/blog.nix rename to hosts/wolumonde/modules/blog.nix diff --git a/hosts/wolumonde/gitea.nix b/hosts/wolumonde/modules/gitea.nix similarity index 100% rename from hosts/wolumonde/gitea.nix rename to hosts/wolumonde/modules/gitea.nix diff --git a/hosts/wolumonde/hardware-configuration.nix b/hosts/wolumonde/modules/hardware-configuration.nix similarity index 100% rename from hosts/wolumonde/hardware-configuration.nix rename to hosts/wolumonde/modules/hardware-configuration.nix diff --git a/hosts/wolumonde/nginx.nix b/hosts/wolumonde/modules/nginx.nix similarity index 100% rename from hosts/wolumonde/nginx.nix rename to hosts/wolumonde/modules/nginx.nix diff --git a/hosts/wolumonde/nixinate.nix b/hosts/wolumonde/modules/nixinate.nix similarity index 100% rename from hosts/wolumonde/nixinate.nix rename to hosts/wolumonde/modules/nixinate.nix diff --git a/hosts/wolumonde/ssh.nix b/hosts/wolumonde/modules/ssh.nix similarity index 100% rename from hosts/wolumonde/ssh.nix rename to hosts/wolumonde/modules/ssh.nix