diff options
| author | Alejandro Soto <alejandro@34project.org> | 2022-08-08 04:08:26 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2022-08-08 04:11:32 -0600 |
| commit | 45e6f5587faed8b8b1de59caffad5ad027bbb118 (patch) | |
| tree | fca193d1415b92530a46bcb0e237c67d6eaf92ad /sys/net.nix | |
| parent | 48d2ef9f8bc681e73380f89872fa55a0a86e9161 (diff) | |
sys/net: move out of sys/default.nix
Diffstat (limited to 'sys/net.nix')
| -rw-r--r-- | sys/net.nix | 31 |
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 ]; + }; +} |
