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;
|
|
|
|
|
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
|
|
|
|
|
./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 = {
|
|
|
|
|
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; }; }; };
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|