2020-01-04 22:16:31 +00:00
|
|
|
|
# Edit this configuration file to define what should be installed on
|
|
|
|
|
# your system. Help is available in the configuration.nix(5) man page
|
|
|
|
|
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
|
|
|
|
|
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
2020-01-17 15:29:51 +00:00
|
|
|
|
let
|
|
|
|
|
vars = import ./vars.nix;
|
2020-01-23 19:47:42 +00:00
|
|
|
|
unstable = import <unstable> { };
|
2020-01-04 22:16:31 +00:00
|
|
|
|
|
|
|
|
|
in {
|
|
|
|
|
imports = [
|
|
|
|
|
# Include the results of the hardware scan.
|
|
|
|
|
./hardware-configuration.nix
|
|
|
|
|
|
|
|
|
|
# Base router networking.
|
|
|
|
|
./networking.nix
|
|
|
|
|
./nftables.nix
|
|
|
|
|
|
|
|
|
|
# Networking daemons.
|
|
|
|
|
./coredns.nix
|
|
|
|
|
./corerad.nix
|
|
|
|
|
./dhcpd4.nix
|
2020-01-23 19:47:42 +00:00
|
|
|
|
./traefik.nix
|
2020-01-04 22:16:31 +00:00
|
|
|
|
./wgipamd.nix
|
|
|
|
|
|
2020-01-17 15:29:51 +00:00
|
|
|
|
# Unstable modules.
|
|
|
|
|
<unstable/nixos/modules/services/networking/corerad.nix>
|
|
|
|
|
|
|
|
|
|
# Out-of-tree modules.
|
2020-01-04 22:16:31 +00:00
|
|
|
|
./modules/wgipamd.nix
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
nixpkgs.overlays = [
|
|
|
|
|
(self: super: {
|
|
|
|
|
wgipamd = super.callPackage ./pkgs/wgipamd.nix {
|
|
|
|
|
buildGoModule = super.buildGo113Module;
|
|
|
|
|
};
|
|
|
|
|
})
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
# Use the GRUB 2 boot loader with MBR.
|
|
|
|
|
boot = {
|
|
|
|
|
kernel = {
|
|
|
|
|
sysctl = {
|
|
|
|
|
# Forward on all interfaces.
|
|
|
|
|
"net.ipv4.conf.all.forwarding" = true;
|
|
|
|
|
"net.ipv6.conf.all.forwarding" = true;
|
|
|
|
|
|
|
|
|
|
# By default, not automatically configure any IPv6 addresses.
|
|
|
|
|
"net.ipv6.conf.all.accept_ra" = 0;
|
|
|
|
|
"net.ipv6.conf.all.autoconf" = 0;
|
|
|
|
|
"net.ipv6.conf.all.use_tempaddr" = 0;
|
|
|
|
|
|
|
|
|
|
# On WAN, allow IPv6 autoconfiguration and tempory address use.
|
|
|
|
|
"net.ipv6.conf.${vars.interfaces.wan0.name}.accept_ra" = 2;
|
|
|
|
|
"net.ipv6.conf.${vars.interfaces.wan0.name}.autoconf" = 1;
|
|
|
|
|
"net.ipv6.conf.${vars.interfaces.wan0.name}.use_tempaddr" = 1;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
# Enable serial console support.
|
|
|
|
|
kernelParams = [ "console=ttyS0,115200n8" ];
|
|
|
|
|
# Use GRUB in MBR mode.
|
|
|
|
|
loader.grub = {
|
|
|
|
|
enable = true;
|
|
|
|
|
version = 2;
|
|
|
|
|
device = "/dev/sda";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# Select internationalisation properties.
|
|
|
|
|
i18n = {
|
|
|
|
|
consoleFont = "Lat2-Terminus16";
|
|
|
|
|
consoleKeyMap = "us";
|
|
|
|
|
defaultLocale = "en_US.UTF-8";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# Set your time zone.
|
|
|
|
|
time.timeZone = "America/Detroit";
|
|
|
|
|
|
|
|
|
|
# List packages installed in system profile. To search, run:
|
|
|
|
|
# $ nix search wget
|
|
|
|
|
environment.systemPackages = with pkgs; [
|
2020-01-17 15:29:51 +00:00
|
|
|
|
# Stable packages.
|
2020-01-04 22:16:31 +00:00
|
|
|
|
bind
|
|
|
|
|
byobu
|
|
|
|
|
cbfstool
|
|
|
|
|
dmidecode
|
|
|
|
|
ethtool
|
|
|
|
|
flashrom
|
|
|
|
|
gcc
|
|
|
|
|
go
|
|
|
|
|
git
|
|
|
|
|
htop
|
|
|
|
|
iftop
|
2020-01-17 19:17:53 +00:00
|
|
|
|
iperf3
|
2020-01-07 21:58:46 +00:00
|
|
|
|
jq
|
2020-01-04 22:16:31 +00:00
|
|
|
|
lm_sensors
|
2020-01-12 22:20:15 +00:00
|
|
|
|
lshw
|
2020-01-07 19:18:31 +00:00
|
|
|
|
ndisc6
|
2020-01-04 22:16:31 +00:00
|
|
|
|
nixfmt
|
|
|
|
|
tcpdump
|
|
|
|
|
tmux
|
|
|
|
|
wget
|
|
|
|
|
wireguard-tools
|
2020-01-17 15:29:51 +00:00
|
|
|
|
|
|
|
|
|
# Unstable packages.
|
|
|
|
|
unstable.corerad
|
2020-01-04 22:16:31 +00:00
|
|
|
|
];
|
|
|
|
|
|
2020-01-21 17:31:16 +00:00
|
|
|
|
# Automatic Nix GC.
|
|
|
|
|
nix = {
|
|
|
|
|
gc = {
|
|
|
|
|
automatic = true;
|
|
|
|
|
dates = "weekly";
|
|
|
|
|
};
|
|
|
|
|
extraOptions = ''
|
|
|
|
|
min-free = ${toString (500 * 1024 * 1024)}
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2020-01-04 22:16:31 +00:00
|
|
|
|
services = {
|
2020-02-04 21:46:49 +00:00
|
|
|
|
# Allow mDNS to reflect between VLANs where necessary for devices such as
|
|
|
|
|
# Google Home and Chromecast.
|
|
|
|
|
avahi = {
|
|
|
|
|
enable = true;
|
|
|
|
|
interfaces =
|
|
|
|
|
[ "${vars.interfaces.lan0.name}" "${vars.interfaces.iot0.name}" ];
|
|
|
|
|
ipv4 = true;
|
|
|
|
|
ipv6 = true;
|
|
|
|
|
reflector = true;
|
|
|
|
|
};
|
|
|
|
|
|
2020-01-04 22:16:31 +00:00
|
|
|
|
apcupsd = { enable = true; };
|
|
|
|
|
|
2020-01-13 14:38:27 +00:00
|
|
|
|
fwupd = { enable = true; };
|
|
|
|
|
|
2020-01-04 22:16:31 +00:00
|
|
|
|
# Enable the OpenSSH daemon.
|
|
|
|
|
openssh = {
|
|
|
|
|
enable = true;
|
|
|
|
|
passwordAuthentication = false;
|
|
|
|
|
permitRootLogin = "no";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
prometheus = { exporters = { node = { enable = true; }; }; };
|
2020-01-24 18:21:52 +00:00
|
|
|
|
|
|
|
|
|
tftpd = {
|
|
|
|
|
enable = true;
|
|
|
|
|
path = "/var/lib/tftp";
|
|
|
|
|
};
|
2020-01-04 22:16:31 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
users.users.matt = {
|
|
|
|
|
isNormalUser = true;
|
|
|
|
|
uid = 1000;
|
|
|
|
|
extraGroups = [ "wheel" ];
|
|
|
|
|
|
|
|
|
|
openssh.authorizedKeys.keys = [
|
|
|
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN5i5d0mRKAf02m+ju+I1KrAYw3Ny2IHXy88mgyragBN Matt Layher (mdlayher@gmail.com)"
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
|
2020-01-17 20:30:34 +00:00
|
|
|
|
system = {
|
|
|
|
|
# Automatic upgrades.
|
|
|
|
|
autoUpgrade = { enable = true; };
|
|
|
|
|
|
|
|
|
|
# This value determines the NixOS release with which your system is to be
|
|
|
|
|
# compatible, in order to avoid breaking some software such as database
|
|
|
|
|
# servers. You should change this only after NixOS release notes say you
|
|
|
|
|
# should.
|
|
|
|
|
stateVersion = "19.09"; # Did you read the comment?
|
|
|
|
|
};
|
2020-01-04 22:16:31 +00:00
|
|
|
|
}
|