2021-10-23 03:06:06 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
2020-09-27 14:27:25 +02:00
|
|
|
|
2021-10-23 03:06:06 +02:00
|
|
|
let
|
|
|
|
# mkdir /etc/secrets/initrd -p
|
|
|
|
# chmod 700 -R /etc/secrets/
|
|
|
|
# ssh-keygen -t ed25519 -N "" -f /etc/secrets/initrd/ssh_host_ed25519_key
|
|
|
|
hostKeys = [{
|
|
|
|
path = "/etc/secrets/initrd/ssh_host_ed25519_key";
|
|
|
|
type = "ed25519";
|
|
|
|
}];
|
|
|
|
in with builtins; {
|
2020-09-27 14:27:25 +02:00
|
|
|
imports = [
|
|
|
|
# ./hardware/base.nix
|
2020-10-06 18:09:04 +02:00
|
|
|
./hardware/gpu-rpi4.nix
|
2020-09-27 14:27:25 +02:00
|
|
|
# ./system
|
|
|
|
./system/nix.nix
|
|
|
|
./system/i18n.nix
|
2021-05-11 21:26:18 +02:00
|
|
|
./system/networking.nix
|
2022-05-01 16:42:56 +02:00
|
|
|
./modules/emailNotify.nix
|
|
|
|
./services/mail.nix
|
2021-03-21 14:24:35 +01:00
|
|
|
./services/restic/rpi4.nix
|
2022-02-04 23:23:34 +01:00
|
|
|
./services/samba/rpi4.nix
|
2020-10-06 17:44:49 +02:00
|
|
|
./services/syncthing/rpi4.nix
|
2021-12-11 19:42:30 +01:00
|
|
|
# ./services/kodi.nix
|
2020-10-06 17:41:56 +02:00
|
|
|
./services/jellyfin.nix
|
2021-02-15 21:06:51 +01:00
|
|
|
./services/etebase.nix
|
2021-12-12 19:20:31 +01:00
|
|
|
./services/mosquitto.nix
|
2020-10-03 16:32:06 +02:00
|
|
|
./services/home-assistant.nix
|
2020-12-02 10:33:12 +01:00
|
|
|
./services/owntracks.nix
|
2021-12-11 19:40:53 +01:00
|
|
|
./services/miniflux.nix
|
2021-12-22 13:03:14 +01:00
|
|
|
./services/paperless.nix
|
2021-12-22 17:36:29 +01:00
|
|
|
./services/nextcloud.nix
|
2020-09-27 14:27:25 +02:00
|
|
|
];
|
|
|
|
|
2022-05-06 03:16:17 +02:00
|
|
|
age.secrets.cfdyndns = {
|
|
|
|
file = ./secrets/cfdyndns.age;
|
|
|
|
owner = "cfdyndns";
|
|
|
|
group = "cfdyndns";
|
|
|
|
};
|
|
|
|
age.secrets.hostKey.file = ./secrets/home-server/hostKey.age;
|
|
|
|
|
2020-09-27 14:27:25 +02:00
|
|
|
nixpkgs.config.allowUnfree = true;
|
|
|
|
|
|
|
|
# rpi4 base config
|
2022-02-07 23:53:12 +01:00
|
|
|
boot.loader.generic-extlinux-compatible.enable = false;
|
2020-09-27 14:27:25 +02:00
|
|
|
boot.loader.raspberryPi.enable = true;
|
|
|
|
boot.loader.raspberryPi.version = 4;
|
2022-02-07 23:53:12 +01:00
|
|
|
# boot.loader.raspberryPi.uboot.enable = true;
|
2021-10-23 03:07:12 +02:00
|
|
|
boot.loader.raspberryPi.firmwareConfig = ''
|
|
|
|
gpu_mem=320
|
|
|
|
hdmi_group=1
|
|
|
|
hdmi_mode=97
|
|
|
|
hdmi_enable_4kp60=1
|
|
|
|
disable_overscan=1
|
|
|
|
'';
|
2020-10-06 17:41:56 +02:00
|
|
|
boot.kernelParams = [ "console=ttyAMA0,115200" "console=tty1" ];
|
2020-09-27 14:27:25 +02:00
|
|
|
|
2020-10-03 16:23:36 +02:00
|
|
|
networking.domain = "home.felschr.com";
|
|
|
|
|
2020-10-06 17:41:56 +02:00
|
|
|
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
2021-10-23 03:20:38 +02:00
|
|
|
networking.firewall.allowedUDPPorts = [ 80 443 ];
|
2020-10-03 16:23:36 +02:00
|
|
|
|
2022-01-01 02:06:35 +01:00
|
|
|
security.acme.acceptTerms = true;
|
|
|
|
security.acme.defaults.email = "dev@felschr.com";
|
2020-10-03 16:23:36 +02:00
|
|
|
|
2021-11-27 20:12:04 +01:00
|
|
|
services.ddclient = {
|
2020-10-03 16:23:36 +02:00
|
|
|
enable = true;
|
2021-11-27 20:12:04 +01:00
|
|
|
protocol = "cloudflare";
|
|
|
|
ssl = true;
|
|
|
|
use = "web";
|
|
|
|
zone = "felschr.com";
|
|
|
|
username = "felschr@pm.me";
|
2022-05-04 03:02:47 +02:00
|
|
|
passwordFile = config.age.secrets.cfdyndns.path;
|
2021-11-27 20:12:04 +01:00
|
|
|
domains = [
|
2021-02-14 23:49:43 +01:00
|
|
|
"home.felschr.com"
|
2021-12-22 17:36:29 +01:00
|
|
|
"cloud.felschr.com"
|
2022-02-07 23:52:38 +01:00
|
|
|
"office.felschr.com"
|
2021-05-27 19:42:39 +02:00
|
|
|
"media.felschr.com"
|
2021-12-11 19:40:53 +01:00
|
|
|
"news.felschr.com"
|
2021-10-23 03:20:38 +02:00
|
|
|
"mqtt.felschr.com"
|
2021-02-14 23:49:43 +01:00
|
|
|
"owntracks.felschr.com"
|
2021-02-15 21:06:51 +01:00
|
|
|
"etebase.felschr.com"
|
2021-12-22 13:03:14 +01:00
|
|
|
"paperless.felschr.com"
|
2021-02-14 23:49:43 +01:00
|
|
|
];
|
2020-10-03 16:23:36 +02:00
|
|
|
};
|
|
|
|
|
2020-10-03 16:32:06 +02:00
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
recommendedTlsSettings = true;
|
|
|
|
recommendedOptimisation = true;
|
|
|
|
recommendedGzipSettings = true;
|
|
|
|
recommendedProxySettings = true;
|
|
|
|
};
|
|
|
|
|
2020-09-27 14:27:25 +02:00
|
|
|
programs.zsh.enable = true;
|
|
|
|
|
2020-10-03 19:13:33 +02:00
|
|
|
services.openssh = {
|
|
|
|
enable = true;
|
2022-02-04 18:40:00 +01:00
|
|
|
kbdInteractiveAuthentication = false;
|
2020-10-03 19:13:33 +02:00
|
|
|
passwordAuthentication = false;
|
|
|
|
permitRootLogin = "no";
|
2021-10-23 03:06:06 +02:00
|
|
|
inherit hostKeys;
|
2020-10-03 19:13:33 +02:00
|
|
|
};
|
|
|
|
|
2021-06-10 12:01:40 +02:00
|
|
|
# ssh root@hostname "echo "$(read -s pass; echo \'"$pass"\')" > /crypt-ramfs/passphrase"
|
2021-10-23 03:06:06 +02:00
|
|
|
boot.initrd.network = {
|
2020-10-03 19:13:33 +02:00
|
|
|
enable = true;
|
2021-10-23 03:06:06 +02:00
|
|
|
ssh = {
|
|
|
|
enable = true;
|
|
|
|
# requires support for initrd secrets (might work w/ uboot when it's supported)
|
|
|
|
# hostKeys = map (f: f.path) hostKeys;
|
|
|
|
hostKeys = [ ./host_key ];
|
|
|
|
authorizedKeys = config.users.users.felschr.openssh.authorizedKeys.keys;
|
|
|
|
};
|
2020-10-03 19:13:33 +02:00
|
|
|
};
|
2020-09-27 14:27:25 +02:00
|
|
|
|
2021-12-22 17:18:37 +01:00
|
|
|
virtualisation.oci-containers.backend = "podman";
|
|
|
|
|
2022-05-01 16:42:56 +02:00
|
|
|
systemd.emailNotify.enable = true;
|
|
|
|
systemd.emailNotify.mailTo = "admin@felschr.com";
|
|
|
|
systemd.emailNotify.mailFrom =
|
|
|
|
"${config.networking.hostName} <felschr@web.de>";
|
|
|
|
|
2020-09-27 14:27:25 +02:00
|
|
|
# only change this when specified in release notes
|
2021-12-01 10:47:09 +01:00
|
|
|
system.stateVersion = "21.11";
|
2020-09-27 14:27:25 +02:00
|
|
|
}
|