diff --git a/hosts/homex/network.nix b/hosts/homex/network.nix deleted file mode 100644 index 61221d5..0000000 --- a/hosts/homex/network.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = [ ]; - config = { - host.networking.hostName = "homex"; - }; -} - - - diff --git a/modules/nixos/homelab/default.nix b/modules/nixos/homelab/default.nix index 19adc6e..7f0af0c 100644 --- a/modules/nixos/homelab/default.nix +++ b/modules/nixos/homelab/default.nix @@ -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; diff --git a/modules/nixos/homelab/network.nix b/modules/nixos/homelab/network.nix index 0948a7c..0337adb 100644 --- a/modules/nixos/homelab/network.nix +++ b/modules/nixos/homelab/network.nix @@ -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 = [{