1
0

Compare commits

..

No commits in common. "8d623692c7da930fd80b1ea48c94220905aca23e" and "8748015accfadf62f115aa15c9ff2a2ebccdaa5d" have entirely different histories.

4 changed files with 40 additions and 20 deletions

View File

@ -19,14 +19,6 @@
generateNixosSystem = name: nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({ ... }: {
/*
Make the contents of the flake availiable to modules.
Useful for having the monitoring server scraping the
target config from all other servers automatically.
*/
_module.args._nixfiles = self;
})
./configuration/common
({ ... }: {
nixpkgs.overlays = [

View File

@ -0,0 +1,12 @@
{ ... }:
{
networking.hostName = "mail-1";
clerie.monitoring = {
enable = true;
id = "208";
pubkey = "s2GT9iYQmuiwkZ04KzSqqlIEbUJ6CT6i4htCjWYt2xs=";
nixos = false;
};
}

View File

@ -1,19 +1,9 @@
{ config, pkgs, lib, _nixfiles, ... }:
{ config, pkgs, lib, ... }:
with lib;
let
hosts = _nixfiles.nixosConfigurations // {
"mail-1".config = {
networking.hostName = "mail-1";
clerie.monitoring = {
enable = true;
id = "208";
pubkey = "s2GT9iYQmuiwkZ04KzSqqlIEbUJ6CT6i4htCjWYt2xs=";
nixos = false;
};
};
};
hosts = (import ../../lib/hosts.nix { inherit pkgs; }).hosts;
monitoringHosts = filterAttrs (name: host:
attrByPath ["clerie" "monitoring" "enable"] false host.config)

26
lib/hosts.nix Normal file
View File

@ -0,0 +1,26 @@
{ pkgs ? import ../pkgs {} }:
with pkgs.lib;
rec {
hostsDir = ../hosts;
hostNames = attrNames (
filterAttrs (
name: type: type == "directory"
) (
builtins.readDir hostsDir
)
);
hosts = listToAttrs (
map (
hostName: nameValuePair hostName (
import (pkgs.path + "/nixos") {
configuration = import (hostsDir + "/${hostName}/configuration.nix");
system = "x86_64-linux";
}
)
) hostNames
);
}