1
0

Compare commits

...

2 Commits

3 changed files with 28 additions and 21 deletions

View File

@ -90,7 +90,7 @@
_iso = { name = "_iso"; }; _iso = { name = "_iso"; };
}; };
nixosConfigurations = helper.mapToNixosConfigurations self.clerie.hosts; nixosConfigurations = import ./flake/nixosConfigurations.nix inputs;
nixosModules = { nixosModules = {
nixfilesInputs = import ./flake/modules.nix inputs; nixfilesInputs = import ./flake/modules.nix inputs;

View File

@ -1,6 +1,9 @@
{ self, nixpkgs, fernglas, fieldpoc, nixos-exporter, solid-xmpp-alarm, sops-nix, ... }@inputs: { self
, nixpkgs
, ...
}@inputs:
rec { let
generateNixosSystem = { generateNixosSystem = {
name, name,
system ? "x86_64-linux", system ? "x86_64-linux",
@ -13,7 +16,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 +33,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,8 +49,17 @@ rec {
in in
secrets; secrets;
}) })
# Config to be applied to every host
../configuration/common
../users/clerie
# Host specific config
(../hosts + "/${name}/configuration.nix")
]; ];
}; };
mapToNixosConfigurations = hosts: builtins.mapAttrs (name: host: generateNixosSystem host) hosts; mapToNixosConfigurations = hosts: builtins.mapAttrs (name: host: generateNixosSystem host) hosts;
}
in
mapToNixosConfigurations self.clerie.hosts

View File

@ -7,10 +7,6 @@ let
} // inputs); } // inputs);
lib = { lib = {
flake-helper = callLibs ./flake-helper.nix;
inherit ("flake-helper")
generateNixosSystem
mapToNixosConfigurations;
clerie-monitoring-ids = callLibs ./clerie-monitoring-ids.nix; clerie-monitoring-ids = callLibs ./clerie-monitoring-ids.nix;
}; };