1
0
Fork 0
mirror of https://github.com/mdlayher/homelab.git synced 2024-12-14 11:47:32 +00:00
mdlayher-homelab/nixos/routnerr-2/configuration.nix

130 lines
3 KiB
Nix
Raw Normal View History

# 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).
{ pkgs, ... }:
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> { };
in {
imports = [
# Hardware configuration and quirks.
<nixos-hardware/pcengines/apu>
./hardware-configuration.nix
# Base system configuration.
./lib/nix.nix
./lib/system.nix
./lib/users.nix
./lib/node_exporter.nix
# 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
./wgipamd.nix
# Out-of-tree modules.
./lib/modules/wireguard_exporter.nix
./lib/modules/wgipamd.nix
];
# Overlays for out-of-tree packages.
nixpkgs.overlays = [
(self: super: {
wireguard_exporter =
super.callPackage ./lib/pkgs/wireguard_exporter.nix { };
})
];
# Use the GRUB 2 boot loader with MBR.
boot = {
kernel = {
sysctl = with vars.interfaces.wan0; {
# 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.${name}.accept_ra" = 2;
"net.ipv6.conf.${name}.autoconf" = 1;
"net.ipv6.conf.${name}.use_tempaddr" = 1;
};
};
# Use GRUB in MBR mode.
loader.grub = {
enable = true;
version = 2;
device = "/dev/sda";
};
};
# Packages specific to this machine. The base package set is defined in
# lib/system.nix.
environment.systemPackages = with pkgs; [
# Stable packages.
bind
cbfstool
cmatrix
flashrom
# Unstable and out-of-tree packages.
unstable.corerad
wireguard_exporter
];
# Use server as a remote builder.
2020-01-21 17:31:16 +00:00
nix = {
distributedBuilds = true;
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
};
services = {
# Allow mDNS to reflect between VLANs where necessary for devices such as
# Google Home and Chromecast.
avahi = {
enable = true;
interfaces = with vars.interfaces; [ "${lan0.name}" "${iot0.name}" ];
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
# 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";
};
};
}