1
0

lib/flake-helper.nix: Restrcuture host module references

This commit is contained in:
clerie 2024-05-13 17:00:03 +02:00
parent 0453d34606
commit 2a3281a7c4
Signed by: clerie
GPG Key ID: BD9F56480870BAD2

View File

@ -13,7 +13,14 @@ rec {
modules = modules ++ [ modules = modules ++ [
self.nixosModules.nixfilesInputs self.nixosModules.nixfilesInputs
self.nixosModules.clerie self.nixosModules.clerie
({ ... }: {
({ config, lib, ... }: {
# Apply overlays
nixpkgs.overlays = [
self.overlays.nixfilesInputs
self.overlays.clerie
];
/* /*
Make the contents of the flake availiable to modules. Make the contents of the flake availiable to modules.
Useful for having the monitoring server scraping the Useful for having the monitoring server scraping the
@ -23,19 +30,11 @@ rec {
inputs = inputs; inputs = inputs;
_nixfiles = self; _nixfiles = self;
}; };
})
../configuration/common # Expose host group to monitoring
../users/clerie
({ ... }: {
nixpkgs.overlays = [
self.overlays.nixfilesInputs
self.overlays.clerie
];
clerie.monitoring = nixpkgs.lib.attrsets.optionalAttrs (group != null) { serviceLevel = group; }; clerie.monitoring = nixpkgs.lib.attrsets.optionalAttrs (group != null) { serviceLevel = group; };
})
(../hosts + "/${name}/configuration.nix")
# Automatically load secrets from sops file for host # Automatically load secrets from sops file for host
({ config, lib, ... }: {
sops.defaultSopsFile = ../hosts + "/${name}/secrets.json"; sops.defaultSopsFile = ../hosts + "/${name}/secrets.json";
sops.secrets = let sops.secrets = let
secretFile = config.sops.defaultSopsFile; secretFile = config.sops.defaultSopsFile;
@ -47,6 +46,13 @@ rec {
in in
secrets; secrets;
}) })
# Config to be applied to every host
../configuration/common
../users/clerie
# Host specific config
(../hosts + "/${name}/configuration.nix")
]; ];
}; };