modules: add homelab.host for host metadata

Add a shared `homelab.host` module that provides host metadata for
multiple consumers:
- tier: deployment tier (test/prod) for future homelab-deploy service
- priority: alerting priority (high/low) for Prometheus label filtering
- role: primary role of the host (dns, database, monitoring, etc.)
- labels: free-form labels for additional metadata

Host configurations updated with appropriate values:
- ns1, ns2: role=dns with dns_role labels
- nix-cache01: priority=low, role=build-host
- vault01: role=vault
- jump: role=bastion
- template, template2, testvm01, vaulttest01: tier=test, priority=low

The module is now imported via commonModules in flake.nix, making it
available to all hosts including minimal configurations like template2.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-07 02:49:58 +01:00
parent e8a43c6715
commit 12bf0683f5
16 changed files with 82 additions and 2 deletions

View File

@@ -8,6 +8,9 @@
];
nixpkgs.config.allowUnfree = true;
homelab.host.role = "bastion";
# Use the systemd-boot EFI boot loader.
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";

View File

@@ -13,6 +13,11 @@
homelab.dns.cnames = [ "nix-cache" "actions1" ];
homelab.host = {
priority = "low";
role = "build-host";
};
fileSystems."/nix" = {
device = "/dev/disk/by-label/nixcache";
fsType = "xfs";

View File

@@ -49,6 +49,11 @@
];
vault.enable = true;
homelab.host = {
role = "dns";
labels.dns_role = "primary";
};
nix.settings.tarball-ttl = 0;
environment.systemPackages = with pkgs; [
vim

View File

@@ -49,6 +49,11 @@
];
vault.enable = true;
homelab.host = {
role = "dns";
labels.dns_role = "secondary";
};
environment.systemPackages = with pkgs; [
vim
wget

View File

@@ -11,6 +11,11 @@
# Template host - exclude from DNS zone generation
homelab.dns.enable = false;
homelab.host = {
tier = "test";
priority = "low";
};
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";

View File

@@ -32,6 +32,11 @@
datasource_list = [ "ConfigDrive" "NoCloud" ];
};
homelab.host = {
tier = "test";
priority = "low";
};
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/vda";
networking.hostName = "nixos-template2";

View File

@@ -16,6 +16,11 @@
# Test VM - exclude from DNS zone generation
homelab.dns.enable = false;
homelab.host = {
tier = "test";
priority = "low";
};
nixpkgs.config.allowUnfree = true;
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/vda";

View File

@@ -16,6 +16,8 @@
homelab.dns.cnames = [ "vault" ];
homelab.host.role = "vault";
nixpkgs.config.allowUnfree = true;
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/vda";

View File

@@ -39,6 +39,12 @@ in
../../common/vm
];
homelab.host = {
tier = "test";
priority = "low";
role = "vault";
};
nixpkgs.config.allowUnfree = true;
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/vda";