From 2a3281a7c4401c09fc85ea64d2561ea59f01764a Mon Sep 17 00:00:00 2001 From: clerie Date: Mon, 13 May 2024 17:00:03 +0200 Subject: [PATCH] lib/flake-helper.nix: Restrcuture host module references --- lib/flake-helper.nix | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/lib/flake-helper.nix b/lib/flake-helper.nix index d8e9878..ff81862 100644 --- a/lib/flake-helper.nix +++ b/lib/flake-helper.nix @@ -13,7 +13,14 @@ rec { modules = modules ++ [ self.nixosModules.nixfilesInputs self.nixosModules.clerie - ({ ... }: { + + ({ config, lib, ... }: { + # Apply overlays + nixpkgs.overlays = [ + self.overlays.nixfilesInputs + self.overlays.clerie + ]; + /* Make the contents of the flake availiable to modules. Useful for having the monitoring server scraping the @@ -23,19 +30,11 @@ rec { inputs = inputs; _nixfiles = self; }; - }) - ../configuration/common - ../users/clerie - ({ ... }: { - nixpkgs.overlays = [ - self.overlays.nixfilesInputs - self.overlays.clerie - ]; + + # Expose host group to monitoring clerie.monitoring = nixpkgs.lib.attrsets.optionalAttrs (group != null) { serviceLevel = group; }; - }) - (../hosts + "/${name}/configuration.nix") - # Automatically load secrets from sops file for host - ({ config, lib, ... }: { + + # Automatically load secrets from sops file for host sops.defaultSopsFile = ../hosts + "/${name}/secrets.json"; sops.secrets = let secretFile = config.sops.defaultSopsFile; @@ -47,6 +46,13 @@ rec { in secrets; }) + + # Config to be applied to every host + ../configuration/common + ../users/clerie + + # Host specific config + (../hosts + "/${name}/configuration.nix") ]; };