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") ]; };