summaryrefslogtreecommitdiff
path: root/sys/net.nix
diff options
context:
space:
mode:
Diffstat (limited to 'sys/net.nix')
-rw-r--r--sys/net.nix31
1 files changed, 31 insertions, 0 deletions
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 ];
+ };
+}