diff options
Diffstat (limited to '')
| -rw-r--r-- | sys/default.nix | 15 | ||||
| -rw-r--r-- | sys/net.nix | 31 | ||||
| -rw-r--r-- | sys/options.nix | 9 |
3 files changed, 33 insertions, 22 deletions
diff --git a/sys/default.nix b/sys/default.nix index ae1b38f..85b0e5a 100644 --- a/sys/default.nix +++ b/sys/default.nix @@ -7,6 +7,7 @@ in { "${modulesPath}/installer/scan/not-detected.nix" ./auth.nix ./fs + ./net.nix ./options.nix ./users.nix ]; @@ -107,18 +108,6 @@ in { time.timeZone = "America/Costa_Rica"; i18n.defaultLocale = "es_CR.UTF-8"; - networking = { - hostName = cfg.hostname; - useDHCP = false; - useNetworkd = true; - - interfaces = mkIf (cfg.dhcpInterface != null) { - "${cfg.dhcpInterface}".useDHCP = true; - }; - - wireguard.enable = true; - }; - - environment.systemPackages = [ pkgs.dhcpcd pkgs.git ]; + environment.systemPackages = [ pkgs.git ]; }; } diff --git a/sys/net.nix b/sys/net.nix new file mode 100644 index 0000000..30675e0 --- /dev/null +++ b/sys/net.nix @@ -0,0 +1,31 @@ +{ lib, config, pkgs, ... }: +with lib; let + cfg = config.local; +in { + options.local = with lib.types; { + hostname = mkOption { + type = str; + }; + + dhcpInterface = mkOption { + type = nullOr str; + default = null; + }; + }; + + config = { + networking = { + hostName = cfg.hostname; + useDHCP = false; + useNetworkd = true; + + interfaces = mkIf (cfg.dhcpInterface != null) { + "${cfg.dhcpInterface}".useDHCP = true; + }; + + wireguard.enable = true; + }; + + environment.systemPackages = [ pkgs.dhcpcd ]; + }; +} diff --git a/sys/options.nix b/sys/options.nix index c266fd5..e72b3fe 100644 --- a/sys/options.nix +++ b/sys/options.nix @@ -3,10 +3,6 @@ with lib.types; let inherit (lib) mkOption; in { options.local = { - hostname = mkOption { - type = str; - }; - portable = mkOption { type = bool; }; @@ -23,11 +19,6 @@ in { type = bool; }; - dhcpInterface = mkOption { - type = nullOr str; - default = null; - }; - videoDrivers = mkOption { type = listOf str; }; |
