Configuration for my NixOS based systems and Home Manager
1{ ... }:
2{
3 # networking.hostName = "nixos"; # Define your hostname.
4 # Pick only one of the below networking options.
5 # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
6 # networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
7 networking.hostName = "othinus";
8 # I like systemd-networkd
9 systemd.network.enable = true;
10 systemd.network.networks."50-wlp2s0" = {
11 matchConfig.name = "wlp2s0";
12 networkConfig.DHCP = "yes";
13 linkConfig.RequiredForOnline = "no";
14 };
15
16 networking.interfaces = {
17 enp4s0f1 = {
18 ipv4.addresses = [{
19 address = "192.168.1.4";
20 prefixLength = 24;
21 }];
22 };
23 };
24 networking.defaultGateway = {
25 address = "192.168.1.1";
26 interface = "enp4s0f1";
27 };
28
29 networking.nameservers = [
30 "192.168.1.3"
31 "192.168.1.5"
32 "45.90.28.93"
33 "45.90.30.93"
34 ];
35
36 # This is necessary for ZFX
37 networking.hostId = "0d14fe47";
38
39 networking.useNetworkd = true;
40 # TODO: static IP @ 192.168.1.2
41
42 # Configure network proxy if necessary
43 # networking.proxy.default = "http://user:password@proxy:port/";
44 # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
45 # Open ports in the firewall.
46 # networking.firewall.allowedTCPPorts = [ ... ];
47 # networking.firewall.allowedUDPPorts = [ ... ];
48 # Or disable the firewall altogether.
49 # TODO: allow some ports
50 networking.firewall = {
51 enable = true;
52 allowPing = true;
53 allowedTCPPorts = [
54 # iperf3
55 5201
56 ];
57 };
58
59 services.avahi = {
60 enable = true;
61 nssmdns = true;
62 openFirewall = true;
63 publish = {
64 enable = true;
65 addresses = true;
66 workstation = true;
67 };
68 };
69
70}