nixos-config/rpi4.nix

113 lines
2.9 KiB
Nix
Raw Normal View History

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
2021-03-21 14:24:35 +01:00
./services/restic/rpi4.nix
./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
# ./services/photoprism.nix # TODO not working on aarch64 due to tensorflow
./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
2020-09-27 14:27:25 +02:00
];
nixpkgs.config.allowUnfree = true;
# rpi4 base config
boot.loader.grub.enable = false;
2021-10-23 03:07:12 +02:00
boot.loader.generic-extlinux-compatible.enable = true;
2020-09-27 14:27:25 +02:00
boot.loader.raspberryPi.enable = true;
boot.loader.raspberryPi.version = 4;
2021-10-23 03:07:12 +02:00
boot.loader.raspberryPi.uboot.enable = true;
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
security.acme = {
acceptTerms = true;
email = "dev@felschr.com";
2020-10-03 16:23:36 +02:00
};
services.ddclient = {
2020-10-03 16:23:36 +02:00
enable = true;
protocol = "cloudflare";
ssl = true;
use = "web";
zone = "felschr.com";
username = "felschr@pm.me";
passwordFile = "/etc/nixos/secrets/cfdyndns-apikey";
domains = [
"*.home.felschr.com"
"home.felschr.com"
"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"
"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"
];
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;
services.openssh = {
enable = true;
challengeResponseAuthentication = false;
passwordAuthentication = false;
permitRootLogin = "no";
2021-10-23 03:06:06 +02:00
inherit hostKeys;
};
# ssh root@hostname "echo "$(read -s pass; echo \'"$pass"\')" > /crypt-ramfs/passphrase"
2021-10-23 03:06:06 +02:00
boot.initrd.network = {
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-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
}