From 45e6f5587faed8b8b1de59caffad5ad027bbb118 Mon Sep 17 00:00:00 2001 From: Alejandro Soto Date: Mon, 8 Aug 2022 04:08:26 -0600 Subject: sys/net: move out of sys/default.nix --- sys/default.nix | 15 ++------------- sys/net.nix | 31 +++++++++++++++++++++++++++++++ sys/options.nix | 9 --------- 3 files changed, 33 insertions(+), 22 deletions(-) create mode 100644 sys/net.nix (limited to 'sys') 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; }; -- cgit v1.2.3