summaryrefslogtreecommitdiff
path: root/modules/nixfiles/common/networking.nix
blob: 0ff7e3d5e123c4257a68dda348a1f97d3e7227de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{
  config,
  lib,
  pkgs,
  this,
  ...
}:
with lib; {
  hm.home.file.".digrc".text = ''
    +answer
    +multiline
    +recurse
  '';

  networking = {
    hostName = this.hostname;
    hostId = substring 0 8 (builtins.hashString "md5" this.hostname);
    domain = my.domain.shire;

    usePredictableInterfaceNames = false;

    useDHCP = false;

    nameservers = dns.const.quad9.default;

    hosts = {
      "127.0.0.2" = mkForce [];
      "::1" = mkForce [];
    };

    firewall = {
      enable = true;

      logRefusedConnections = false;
      logRefusedPackets = false;

      rejectPackets = false;

      allowPing = config.nixfiles.modules.profiles.headless.enable;
    };
  };

  environment = {
    systemPackages = with pkgs; [dnsutils ldns myip rsync];

    shellAliases = listToAttrs (map
      ({
        name,
        value,
      }:
        nameValuePair name "${pkgs.iproute2}/bin/${value}") [
        {
          name = "bridge";
          value = "bridge -color=always";
        }
        {
          name = "ip";
          value = "ip -color=always";
        }
        {
          name = "tc";
          value = "tc -color=always";
        }
      ]);
  };
}