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’).
|
|
|
|
|
|
2020-04-27 18:27:17 +00:00
|
|
|
|
{ pkgs, ... }:
|
2020-01-04 22:16:31 +00:00
|
|
|
|
|
2020-01-17 15:29:51 +00:00
|
|
|
|
let
|
2020-04-28 13:22:01 +00:00
|
|
|
|
vars = import ./lib/vars.nix;
|
2020-01-23 19:47:42 +00:00
|
|
|
|
unstable = import <unstable> { };
|
2020-01-04 22:16:31 +00:00
|
|
|
|
|
|
|
|
|
in {
|
|
|
|
|
imports = [
|
2020-02-19 01:51:32 +00:00
|
|
|
|
# Hardware configuration and quirks.
|
|
|
|
|
<nixos-hardware/pcengines/apu>
|
2020-01-04 22:16:31 +00:00
|
|
|
|
./hardware-configuration.nix
|
|
|
|
|
|
2020-04-26 15:42:29 +00:00
|
|
|
|
# Base system configuration.
|
2020-04-26 15:59:10 +00:00
|
|
|
|
./lib/nix.nix
|
2020-04-26 15:50:56 +00:00
|
|
|
|
./lib/system.nix
|
2020-04-26 15:42:29 +00:00
|
|
|
|
./lib/users.nix
|
2020-04-26 18:42:41 +00:00
|
|
|
|
./lib/node_exporter.nix
|
2020-04-26 15:42:29 +00:00
|
|
|
|
|
2020-01-04 22:16:31 +00:00
|
|
|
|
# Base router networking.
|
|
|
|
|
./networking.nix
|
|
|
|
|
./nftables.nix
|
|
|
|
|
|
|
|
|
|
# Networking daemons.
|
|
|
|
|
./coredns.nix
|
|
|
|
|
./corerad.nix
|
|
|
|
|
./dhcpd4.nix
|
2020-02-12 22:30:13 +00:00
|
|
|
|
./dhcpd6.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
|
|
|
|
# Out-of-tree modules.
|
2020-04-22 14:19:56 +00:00
|
|
|
|
./lib/modules/wgipamd.nix
|
2020-01-04 22:16:31 +00:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
# Use the GRUB 2 boot loader with MBR.
|
|
|
|
|
boot = {
|
|
|
|
|
kernel = {
|
2020-04-28 12:51:24 +00:00
|
|
|
|
sysctl = with vars.interfaces.wan0; {
|
2020-01-04 22:16:31 +00:00
|
|
|
|
# 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.
|
2020-04-28 12:51:24 +00:00
|
|
|
|
"net.ipv6.conf.${name}.accept_ra" = 2;
|
|
|
|
|
"net.ipv6.conf.${name}.autoconf" = 1;
|
|
|
|
|
"net.ipv6.conf.${name}.use_tempaddr" = 1;
|
2020-01-04 22:16:31 +00:00
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
# Use GRUB in MBR mode.
|
|
|
|
|
loader.grub = {
|
|
|
|
|
enable = true;
|
|
|
|
|
version = 2;
|
|
|
|
|
device = "/dev/sda";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-04-26 15:55:40 +00:00
|
|
|
|
# Packages specific to this machine. The base package set is defined in
|
|
|
|
|
# lib/system.nix.
|
2020-04-26 15:50:56 +00:00
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
|
# Stable packages.
|
|
|
|
|
bind
|
|
|
|
|
cbfstool
|
|
|
|
|
flashrom
|
|
|
|
|
|
|
|
|
|
# Unstable packages.
|
|
|
|
|
unstable.corerad
|
|
|
|
|
];
|
2020-01-04 22:16:31 +00:00
|
|
|
|
|
2020-04-26 15:59:10 +00:00
|
|
|
|
# Use server as a remote builder.
|
2020-01-21 17:31:16 +00:00
|
|
|
|
nix = {
|
2020-04-26 15:59:10 +00:00
|
|
|
|
distributedBuilds = true;
|
2020-04-26 15:19:45 +00:00
|
|
|
|
buildMachines = [{
|
|
|
|
|
hostName = "servnerr-3";
|
|
|
|
|
system = "x86_64-linux";
|
|
|
|
|
maxJobs = 8;
|
|
|
|
|
cores = 2;
|
|
|
|
|
speedFactor = 2;
|
|
|
|
|
supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ];
|
|
|
|
|
}];
|
2020-01-21 17:31:16 +00:00
|
|
|
|
};
|
|
|
|
|
|
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;
|
2020-04-28 12:51:24 +00:00
|
|
|
|
interfaces = with vars.interfaces; [ "${lan0.name}" "${iot0.name}" ];
|
2020-02-04 21:46:49 +00:00
|
|
|
|
ipv4 = true;
|
|
|
|
|
ipv6 = true;
|
|
|
|
|
reflector = true;
|
|
|
|
|
};
|
|
|
|
|
|
2020-02-12 20:39:33 +00:00
|
|
|
|
apcupsd.enable = true;
|
2020-04-21 20:35:30 +00:00
|
|
|
|
|
2020-02-12 20:39:33 +00:00
|
|
|
|
lldpd.enable = true;
|
2020-01-13 14:38:27 +00:00
|
|
|
|
|
2020-01-04 22:16:31 +00:00
|
|
|
|
# Enable the OpenSSH daemon.
|
|
|
|
|
openssh = {
|
|
|
|
|
enable = true;
|
|
|
|
|
passwordAuthentication = false;
|
|
|
|
|
permitRootLogin = "no";
|
|
|
|
|
};
|
|
|
|
|
|
2020-01-24 18:21:52 +00:00
|
|
|
|
tftpd = {
|
|
|
|
|
enable = true;
|
|
|
|
|
path = "/var/lib/tftp";
|
|
|
|
|
};
|
2020-01-04 22:16:31 +00:00
|
|
|
|
};
|
|
|
|
|
}
|