feat: homelab name

This commit is contained in:
Gustavo "Guz" L. de Mello
2024-01-28 21:33:05 -03:00
parent 37b2ba8663
commit ea069ecfd1
3 changed files with 11 additions and 12 deletions

View File

@@ -1,11 +0,0 @@
{ config, pkgs, ... }:
{
imports = [ ];
config = {
host.networking.hostName = "homex";
};
}

View File

@@ -31,6 +31,10 @@ in
];
options.homelab = with lib; with lib.types; {
enable = mkEnableOption "";
name = mkOption {
type = str;
default = "homelab";
};
flakeDir = mkOption {
type = str;
};
@@ -41,7 +45,7 @@ in
};
domain = mkOption {
type = either str path;
default = "homelab.local";
default = "${cfg.name}.local";
};
localIp = mkOption {
type = str;

View File

@@ -10,6 +10,10 @@ in
type = bool;
default = true;
};
hostName = mkOption {
type = str;
default = config.homelab.name;
};
interface = mkOption {
type = str;
};
@@ -36,6 +40,8 @@ in
settings = { };
};
config = lib.mkIf cfg.enable {
host.networking.hostName = cfg.hostName;
networking = {
dhcpcd.enable = true;
interfaces."${cfg.interface}".ipv4.addresses = [{