2020-05-23 13:17:37 +02: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’ ).
2021-05-29 18:05:31 +02:00
let sources = import ../../nix/sources.nix ;
in { config , lib , pkgs , . . . }:
2020-05-23 13:17:37 +02:00
{
2021-05-29 18:05:31 +02:00
imports = [ # Include the results of the hardware scan.
../physical/apu2c4.nix
#<yori-nix/roles/homeserver.nix>
../roles
" ${ sources . nixos-hardware } / p c e n g i n e s / a p u "
<nixpkgs/nixos/modules/profiles/minimal.nix>
] ;
2020-05-23 13:17:37 +02:00
boot . loader . grub . enable = true ;
boot . loader . grub . version = 2 ;
boot . loader . grub . device = " / d e v / s d a " ; # or "nodev" for efi only
boot . kernel . sysctl = {
" n e t . i p v 6 . c o n f . a l l . f o r w a r d i n g " = true ;
" n e t . i p v 6 . c o n f . e n p 1 s 0 . a c c e p t _ r a " = 2 ;
} ;
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
networking . useDHCP = false ;
networking . interfaces . enp1s0 = {
useDHCP = true ;
tempAddress = " d i s a b l e d " ;
} ;
#networking.interfaces.enp2s0.useDHCP = false;
networking . interfaces . enp3s0 . useDHCP = false ;
networking . interfaces . enp2s0 = {
tempAddress = " d i s a b l e d " ;
ipv4 . addresses = [ {
address = " 1 9 2 . 1 6 8 . 1 7 8 . 1 " ;
prefixLength = 24 ;
} ] ;
useDHCP = true ;
} ;
# systemd.services.network-link-br0.unitConfig.After = lib.mkForce [ "network-pre.target" "br0-netdev.service" ];
# systemd.services.network-link-br0.unitConfig.BindsTo = lib.mkForce [ "br0-netdev.service" ];
networking . nat = {
enable = true ;
externalInterface = " d s l i t e 1 " ;
internalIPs = [ " 1 9 2 . 1 6 8 . 1 7 8 . 1 / 2 4 " ] ;
} ;
networking . defaultGateway = {
address = " 1 9 2 . 0 . 0 . 1 " ;
interface = " d s l i t e 1 " ;
} ;
systemd . services . dslite1-netdev = {
2021-05-29 18:05:31 +02:00
wantedBy =
[ " n e t w o r k - s e t u p . s e r v i c e " " s y s - s u b s y s t e m - n e t - d e v i c e s - d s l i t e 1 . d e v i c e " ] ;
bindsTo = [ ] ;
2020-05-23 13:17:37 +02:00
partOf = [ " n e t w o r k - s e t u p . s e r v i c e " ] ;
2021-05-29 18:05:31 +02:00
after = [
" n e t w o r k - p r e . t a r g e t "
" n e t w o r k - a d d r e s s e s - e n p 1 s 0 . s e r v i c e "
" n e t w o r k - l i n k - e n p 1 s 0 . s e r v i c e "
] ;
2020-05-23 13:17:37 +02:00
before = [ " n e t w o r k - s e t u p . s e r v i c e " ] ;
path = [ pkgs . iproute ] ;
serviceConfig = {
Type = " o n e s h o t " ;
RemainAfterExit = true ;
} ;
script = ''
ip tunnel add dslite1 mode ip4ip6 local 2 a02:a212:2200:4c00:20d:b9ff:fe56:ba04 remote 2001 : 730 : 2000 : 2 : : 31 encaplimit none
ip link set dslite1 up
'' ;
postStop = ''
ip link del dslite1 || true
'' ;
} ;
networking . interfaces . dslite1 = {
mtu = 1452 ; # todo: ipv6 fragmenting?
ipv4 . addresses = [ {
address = " 1 9 2 . 0 . 0 . 2 " ;
prefixLength = 24 ;
} ] ;
} ;
# networking.bridges = {
# br0.interfaces = [ "enp2s0" "enp3s0" ];
# };
networking . dhcpcd . persistent = true ;
# request prefix delegation
networking . dhcpcd . extraConfig = ''
noipv6rs
ipv6only
interface enp1s0
ipv6rs
iaid 1
ia_pd 1 / : : /60 enp2s0/0/64
'' ;
services . dnsmasq = {
enable = true ;
servers = [ " 8 . 8 . 8 . 8 " " 1 . 1 . 1 . 1 " ] ;
} ;
services . dhcpd4 = {
interfaces = [ " e n p 2 s 0 " ] ;
enable = true ;
machines = [
2021-05-29 18:05:31 +02:00
{
hostName = " a m a t e r i a " ;
ethernetAddress = " a 8 : a 1 : 5 9 : 1 5 : 8 b : 6 3 " ;
ipAddress = " 1 9 2 . 1 6 8 . 1 7 8 . 4 2 " ;
}
{
hostName = " b l a c k a d d e r " ;
ethernetAddress = " a 8 : a 1 : 5 9 : 0 3 : 8 a : 7 5 " ;
ipAddress = " 1 9 2 . 1 6 8 . 1 7 8 . 3 3 " ;
}
{
hostName = " f r u m a r " ;
ethernetAddress = " b c : 5 f : f 4 : e 8 : 4 2 : 9 f " ;
ipAddress = " 1 9 2 . 1 6 8 . 1 7 8 . 3 7 " ;
}
{
hostName = " j a r v i s " ;
ethernetAddress = " 1 8 : 1 d : e a : 3 5 : 1 3 : 5 8 " ;
ipAddress = " 1 9 2 . 1 6 8 . 1 7 8 . 3 4 " ;
}
{
hostName = " j a r v i s - d o c k " ;
ethernetAddress = " 6 4 : 4 b : f 0 : 1 0 : 0 5 : f 2 " ;
ipAddress = " 1 9 2 . 1 6 8 . 1 7 8 . 1 3 " ;
}
{
hostName = " p r i n t e r " ;
ethernetAddress = " 3 0 : 0 5 : 5 c : 4 4 : 2 0 : a 7 " ;
ipAddress = " 1 9 2 . 1 6 8 . 1 7 8 . 2 6 " ;
}
{
hostName = " r a s p b e r r y p i " ;
ethernetAddress = " b 8 : 2 7 : e b : b 9 : e c : 3 a " ;
ipAddress = " 1 9 2 . 1 6 8 . 1 7 8 . 2 1 " ;
}
{
hostName = " s m a r t M e t e r " ;
ethernetAddress = " 5 c : c f : 7 f : 2 6 : c a : 9 1 " ;
ipAddress = " 1 9 2 . 1 6 8 . 1 7 8 . 3 0 " ;
}
{
hostName = " g a n g - a p " ;
ethernetAddress = " b 4 : f b : e 4 : 2 d : f c : f 3 " ;
ipAddress = " 1 9 2 . 1 6 8 . 1 7 8 . 3 2 " ;
}
2020-05-23 13:17:37 +02:00
] ;
extraConfig = ''
subnet 192 .168 .178 .0 netmask 255 .255 .255 .0 {
option subnet-mask 255 .255 .255 .0 ;
option broadcast-address 192 .168 .178 .255 ;
option routers 192 .168 .178 .1 ;
option domain-name-servers 192 .168 .178 .1 ;
range 192 .168 .178 .3 192 .168 .178 .200 ;
}
'' ;
} ;
services . radvd = {
enable = true ;
config = ''
interface enp2s0 {
AdvSendAdvert on ;
prefix 2 a02:a212:2200:4c70::/64 {
AdvOnLink on ;
AdvAutonomous on ;
} ;
} ;
'' ;
} ;
networking . firewall . allowedUDPPorts = [ 53 ] ;
networking . firewall . allowedTCPPorts = [ 53 ] ;
services . fstrim . enable = true ;
# Select internationalisation properties.
# i18n = {
# consoleFont = "Lat2-Terminus16";
# consoleKeyMap = "us";
# defaultLocale = "en_US.UTF-8";
# };
# Set your time zone.
time . timeZone = " E u r o p e / A m s t e r d a m " ;
# List packages installed in system profile. To search, run:
# $ nix search wget
# environment.systemPackages = with pkgs; [
# wget vim
# ];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# pinentryFlavor = "gnome3";
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
services . openssh . enable = true ;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Enable CUPS to print documents.
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘ s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system . stateVersion = " 2 0 . 0 9 " ; # Did you read the comment?
services . udisks2 . enable = false ;
boot . supportedFilesystems = lib . mkForce [ " e x t 4 " ] ;
boot . initrd . supportedFilesystems = lib . mkForce [ " e x t 4 " ] ;
security . polkit . enable = false ;
2021-05-29 18:05:31 +02:00
nixpkgs . overlays = [
( self : super : {
dhcpcd = super . dhcpcd . overrideAttrs ( o : rec {
pname = " d h c p c d " ;
version = " 8 . 1 . 9 " ;
src = self . fetchurl {
url = " m i r r o r : / / r o y / ${ pname } / ${ pname } - ${ version } . t a r . x z " ;
sha256 = " 1 k z v 6 1 b g r d 0 z w i y 6 r 2 1 8 z k c c x 3 6 j 9 p 5 m z 1 g x q v b h g 0 5 x n 9 g 5 0 a l f " ;
} ;
patches = [ ] ;
} ) ;
} )
] ;
2020-05-23 13:17:37 +02:00
}