1
0

Compare commits

..

No commits in common. "d55dc358824179f8fa3758ee927a1e6d12be733d" and "0453d346064e6f44507b03bc8a4b87f06bac7958" have entirely different histories.

3 changed files with 21 additions and 28 deletions

View File

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

View File

@ -7,6 +7,10 @@ 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;
}; };

View File

@ -1,9 +1,6 @@
{ self { self, nixpkgs, fernglas, fieldpoc, nixos-exporter, solid-xmpp-alarm, sops-nix, ... }@inputs:
, nixpkgs
, ...
}@inputs:
let rec {
generateNixosSystem = { generateNixosSystem = {
name, name,
system ? "x86_64-linux", system ? "x86_64-linux",
@ -16,14 +13,7 @@ let
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
@ -33,11 +23,19 @@ let
inputs = inputs; inputs = inputs;
_nixfiles = self; _nixfiles = self;
}; };
})
# Expose host group to monitoring ../configuration/common
../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; };
})
# Automatically load secrets from sops file for host (../hosts + "/${name}/configuration.nix")
# 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;
@ -49,17 +47,8 @@ let
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