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/net.nix | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 sys/net.nix (limited to 'sys/net.nix') 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 ]; + }; +} -- cgit v1.2.3