2023-02-07 18:23:51 +01:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
config,
|
2023-04-15 12:21:22 +02:00
|
|
|
nodeName,
|
2023-07-05 15:55:04 +02:00
|
|
|
repoFlake,
|
2023-02-07 18:23:51 +01:00
|
|
|
...
|
|
|
|
}: let
|
2022-11-19 16:33:35 -06:00
|
|
|
passwords = import ../../../variables/passwords.crypt.nix;
|
2023-12-17 23:25:24 +01:00
|
|
|
|
|
|
|
localTcpPorts = [
|
|
|
|
22
|
|
|
|
|
|
|
|
# syncthing
|
|
|
|
22000
|
|
|
|
|
|
|
|
# iperf3
|
|
|
|
5201
|
|
|
|
];
|
|
|
|
|
|
|
|
localUdpPorts = [
|
|
|
|
# syncthing
|
|
|
|
22000
|
|
|
|
21027
|
|
|
|
];
|
|
|
|
|
2020-12-21 14:35:50 +01:00
|
|
|
in {
|
2023-12-01 21:00:17 +01:00
|
|
|
imports = [
|
|
|
|
../../snippets/nix-settings-holo-chain.nix
|
|
|
|
];
|
|
|
|
|
2023-05-23 18:11:30 +02:00
|
|
|
nix.settings = {
|
|
|
|
substituters = [
|
2023-04-15 12:21:22 +02:00
|
|
|
];
|
2023-05-23 18:11:30 +02:00
|
|
|
trusted-public-keys = [
|
2021-08-20 23:28:23 +02:00
|
|
|
];
|
|
|
|
};
|
2020-12-21 14:35:50 +01:00
|
|
|
|
2023-12-17 23:25:24 +01:00
|
|
|
nix.distributedBuilds = true;
|
|
|
|
nix.buildMachines = [
|
|
|
|
{
|
|
|
|
hostName = repoFlake.colmena.sj-bm-hostkey0.deployment.targetHost;
|
|
|
|
# TODO: make this a reference
|
|
|
|
sshUser = "nix-remote-builder";
|
|
|
|
protocol = "ssh-ng";
|
|
|
|
system = "x86_64-linux";
|
|
|
|
maxJobs = 24;
|
|
|
|
speedFactor = 100;
|
|
|
|
supportedFeatures = repoFlake.nixosConfigurations.router0-dmz0.config.nix.settings.system-features ++ [];
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2023-07-05 15:55:04 +02:00
|
|
|
networking.extraHosts = ''
|
|
|
|
'';
|
|
|
|
|
2023-02-07 18:23:51 +01:00
|
|
|
networking.bridges."virbr1".interfaces = [];
|
|
|
|
networking.interfaces."virbr1".ipv4.addresses = [
|
|
|
|
{
|
|
|
|
address = "10.254.254.254";
|
|
|
|
prefixLength = 24;
|
|
|
|
}
|
|
|
|
];
|
2020-12-21 14:35:50 +01:00
|
|
|
|
2023-08-22 10:20:16 +02:00
|
|
|
# needed to make wireguard managed by networkmanager route all traffic through it
|
|
|
|
networking.firewall.checkReversePath = false;
|
|
|
|
|
2020-12-21 14:35:50 +01:00
|
|
|
networking.firewall.enable = true;
|
2023-05-21 11:58:57 +02:00
|
|
|
services.openssh.openFirewall = false;
|
|
|
|
|
|
|
|
# TODO: upstream feature for inverse rule to work: `! --in-interface zt+`
|
2023-12-17 23:25:24 +01:00
|
|
|
networking.firewall.interfaces."eth+".allowedTCPPorts = localTcpPorts;
|
|
|
|
networking.firewall.interfaces."eth+".allowedUDPPorts = localUdpPorts;
|
|
|
|
networking.firewall.interfaces."wlan+".allowedTCPPorts = localTcpPorts;
|
|
|
|
networking.firewall.interfaces."wlan+".allowedUDPPorts = localUdpPorts;
|
2023-10-01 11:10:55 +02:00
|
|
|
|
2020-12-21 14:35:50 +01:00
|
|
|
networking.firewall.logRefusedConnections = false;
|
|
|
|
networking.usePredictableInterfaceNames = false;
|
|
|
|
|
2023-04-15 12:21:22 +02:00
|
|
|
services.fwupd.enable = true;
|
2020-12-21 14:35:50 +01:00
|
|
|
|
|
|
|
services.fprintd.enable = true;
|
|
|
|
security.pam.services = {
|
|
|
|
login.fprintAuth = true;
|
|
|
|
sudo.fprintAuth = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
# virtualization
|
|
|
|
virtualisation = {
|
2023-02-07 18:23:51 +01:00
|
|
|
libvirtd = {enable = true;};
|
2020-12-21 14:35:50 +01:00
|
|
|
|
|
|
|
virtualbox.host = {
|
2022-10-31 11:04:38 +01:00
|
|
|
enable = false;
|
2020-12-21 14:35:50 +01:00
|
|
|
addNetworkInterface = false;
|
|
|
|
};
|
|
|
|
|
2023-04-15 12:21:22 +02:00
|
|
|
podman = {
|
2020-12-21 14:35:50 +01:00
|
|
|
enable = true;
|
2023-04-15 12:21:22 +02:00
|
|
|
dockerCompat = true;
|
2023-05-21 11:58:57 +02:00
|
|
|
# defaultNetwork.dnsname.enable = true;
|
2020-12-21 14:35:50 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-01-10 17:49:31 +01:00
|
|
|
services.samba.extraConfig = ''
|
|
|
|
# client min protocol = NT1
|
|
|
|
'';
|
2023-08-22 10:20:16 +02:00
|
|
|
services.gvfs = {
|
|
|
|
enable = true;
|
|
|
|
package = lib.mkForce pkgs.gnome3.gvfs;
|
|
|
|
};
|
2023-11-23 17:52:21 +01:00
|
|
|
environment.systemPackages = with pkgs; [lxqt.lxqt-policykit]; # provides a default authentification client for policykit
|
2022-01-10 17:49:31 +01:00
|
|
|
|
2023-02-07 18:23:51 +01:00
|
|
|
security.pki.certificateFiles = ["${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"];
|
2020-12-21 14:35:50 +01:00
|
|
|
|
2023-02-07 18:23:51 +01:00
|
|
|
services.xserver.videoDrivers = lib.mkForce ["amdgpu"];
|
2020-12-21 14:35:50 +01:00
|
|
|
services.xserver.serverFlagsSection = ''
|
|
|
|
Option "BlankTime" "0"
|
|
|
|
Option "StandbyTime" "0"
|
|
|
|
Option "SuspendTime" "0"
|
|
|
|
Option "OffTime" "0"
|
|
|
|
'';
|
|
|
|
|
2022-11-19 16:33:35 -06:00
|
|
|
time.timeZone = lib.mkForce passwords.timeZone.stefan;
|
|
|
|
|
2020-12-21 14:35:50 +01:00
|
|
|
hardware.ledger.enable = true;
|
2023-05-21 11:58:57 +02:00
|
|
|
|
|
|
|
services.zerotierone = {
|
|
|
|
enable = true;
|
|
|
|
joinNetworks = [
|
2023-07-05 15:55:04 +02:00
|
|
|
# moved to the service below as it's now secret
|
2023-05-21 11:58:57 +02:00
|
|
|
];
|
|
|
|
};
|
2023-07-05 15:55:04 +02:00
|
|
|
|
|
|
|
systemd.services.zerotieroneSecretNetworks = {
|
2023-12-28 14:01:44 +01:00
|
|
|
enable = false;
|
2023-07-05 15:55:04 +02:00
|
|
|
requiredBy = ["zerotierone.service"];
|
|
|
|
partOf = ["zerotierone.service"];
|
|
|
|
|
|
|
|
serviceConfig.Type = "oneshot";
|
|
|
|
serviceConfig.RemainAfterExit = true;
|
|
|
|
|
|
|
|
script = let
|
|
|
|
secret = config.sops.secrets.zerotieroneNetworks;
|
|
|
|
in ''
|
|
|
|
# include the secret's hash to trigger a restart on change
|
|
|
|
# ${builtins.hashString "sha256" (builtins.toJSON secret)}
|
|
|
|
|
|
|
|
${config.systemd.services.zerotierone.preStart}
|
|
|
|
|
|
|
|
rm -rf /var/lib/zerotier-one/networks.d/*.conf
|
|
|
|
for network in `grep -v '#' ${secret.path}`; do
|
|
|
|
touch /var/lib/zerotier-one/networks.d/''${network}.conf
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
sops.secrets.zerotieroneNetworks = {
|
|
|
|
sopsFile = ../../../../secrets/zerotierone.txt;
|
|
|
|
format = "binary";
|
|
|
|
};
|
2023-08-10 21:45:49 +02:00
|
|
|
|
|
|
|
boot.binfmt.emulatedSystems = [
|
|
|
|
"aarch64-linux"
|
|
|
|
];
|
2020-12-21 14:35:50 +01:00
|
|
|
}
|