1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
{ inputs, config, lib, pkgs, ... }:
{
deployment.targetHost = config.networking.secondaryIP4;
#this enables the following services: restic-server
deployment.tags = [ "resticServer" ];
imports = [
./hardware-configuration.nix
./impermanence.nix
# syncthing (and it's backup)
./syncthing.nix
# fedi server
./gotosocial.nix
./smarthome
./scanner-sftp.nix
./router
./websites
];
# dns.zones."ctu.cx".subdomains."${config.networking.hostName}.home" = (pkgs.dns.lib.combinators.host config.networking.primaryIP4 config.networking.primaryIP);
# dns.zones."ctu.cx".subdomains."${config.networking.hostName}".CNAME = [ "${config.networking.hostName}.home" ];
# dns.zones."ctu.cx".subdomains."home".CNAME = [ "${config.networking.hostName}.home" ];
age.secrets = {
restic-server-briefkasten.file = ../../secrets/restic-server/briefkasten.age;
restic-server-wanderduene.file = ../../secrets/restic-server/wanderduene.age;
};
boot = {
kernelModules = [ "intel_rapl_common" ];
# seems to make realtek ethernet faster?
kernelParams = [
"pcie_aspm=off"
];
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
initrd.network = {
enable = true;
ssh = {
enable = true;
port = 22;
hostKeys = [ /etc/ssh/ssh_host_rsa_key ];
authorizedKeys = with lib; concatLists (mapAttrsToList (name: user: if elem "wheel" user.extraGroups then user.openssh.authorizedKeys.keys else []) config.users.users);
};
postCommands = ''
echo 'cryptsetup-askpass' >> /root/.profile
'' + lib.optionalString config.networking.usePBBUplink ''
sysctl -w net.ipv6.conf.enp1s0.autoconf=0
sysctl -w net.ipv6.conf.enp1s0.accept_ra=0
'' + ''
ip link set dev enp1s0 up
ip addr add ${config.networking.primaryIP4}/28 dev enp1s0
ip addr add ${config.networking.secondaryIP4}/8 dev enp1s0
# ip route add default via 195.39.246.41 dev enp1s0 onlink
'' + lib.optionalString config.networking.usePBBUplink ''
ip addr add ${config.networking.primaryIP}/128 dev enp1s0
# ip route add default via 2a0f:4ac0:acab::1 dev enp1s0 onlink
'';
};
};
nix.optimise.automatic = false;
nix.gc.automatic = false;
systemd.network.networks = {
"40-enp1s0".networkConfig.IPv6AcceptRA = lib.mkIf config.networking.usePBBUplink false;
};
services.logind.extraConfig = ''
# don’t shutdown when power button is short-pressed
HandlePowerKey=ignore
'';
services.udev.extraRules = ''
ACTION=="add", SUBSYSTEM=="net", ENV{INTERFACE}=="iphone", RUN+="${pkgs.systemd}/bin/networkctl up bruplink",
'';
systemd.network.links."10-iphone" = {
matchConfig.PermanentMACAddress = "aa:ab:b5:18:95:d9";
linkConfig.Name = "iphone";
};
networking = {
useNetworkd = true;
usePBBUplink = true;
primaryIP = "2a0f:4ac0:acab::1";
primaryIP4 = "195.39.246.42";
secondaryIP4 = "10.0.0.1";
domain = "home.ctu.cx";
};
services = {
usbmuxd.enable = true;
email-notify.enable = true;
nginx.virtualHosts."${config.networking.fqdn}" = {
enableACME = lib.mkIf (config.networking.usePBBUplink == false) false;
forceSSL = lib.mkIf (config.networking.usePBBUplink == false) false;
kTLS = lib.mkIf (config.networking.usePBBUplink == false) false;
};
nginx.virtualHosts."restic.${config.networking.hostName}.ctu.cx" = {
enableACME = lib.mkIf (config.networking.usePBBUplink == false) false;
forceSSL = lib.mkIf (config.networking.usePBBUplink == false) false;
kTLS = lib.mkIf (config.networking.usePBBUplink == false) false;
};
};
ctucxConfig = {
programs.yt-dlp.enable = true;
programs.ocrmypdf.enable = true;
};
system.stateVersion = "22.11"; # Did you read the comment?
home-manager.users.leah.home.stateVersion = "22.11";
home-manager.users.katja.home.stateVersion = "22.11";
}