summaryrefslogtreecommitdiffstats
path: root/inversepath/usbarmory/host.nix
blob: 87d4d954d30333131df12ebfb8cd40285caef4c1 (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
#
# Module for hosting the USB Armory
#

{ ... }:

let
  staticDevName = "armory0";
in

{
  imports = [ ../../lib/hardware-notes.nix ];

  hardwareNotes =
    [ { title = "USB Armory network interface support";
        text =
          '' - rename the Armory USB network interface
             - set Armory inteface ip to 10.0.0.2/24
             - enable NAT and forward Armory interface
             - add the name 'armory' to /etc/hosts
          '';
      }
    ];

  services.udev.extraRules =
    ''SUBSYSTEM=="net", ACTION=="add", ATTRS{idVendor}=="0525", ATTRS{idProduct}=="a4a2", NAME="${staticDevName}"'';

  networking =
    { interfaces."${staticDevName}".ip4 = [{ address = "10.0.0.2"; prefixLength = 24; }];
      nat = { enable = true; internalInterfaces = [ staticDevName ]; };
      extraHosts = "10.0.0.1 armory";
    };

}