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 = [
|
2022-08-03 03:15:06 +02:00
|
|
|
./hardware/base.nix
|
|
|
|
./hardware/gpu-intel.nix
|
2022-08-06 16:05:25 +02:00
|
|
|
./desktop/x11.nix
|
2022-06-26 13:12:01 +02:00
|
|
|
./system/server.nix
|
2022-05-01 16:42:56 +02:00
|
|
|
./modules/emailNotify.nix
|
|
|
|
./services/mail.nix
|
2022-06-26 13:21:56 +02:00
|
|
|
./services/restic/home-server.nix
|
|
|
|
./services/samba/home-server.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
|
2022-08-12 13:22:32 +02:00
|
|
|
./services/genie.nix
|
2020-10-03 16:32:06 +02:00
|
|
|
./services/home-assistant.nix
|
2022-09-16 17:09:59 +02:00
|
|
|
./services/watchtower.nix
|
2020-12-02 10:33:12 +01:00
|
|
|
./services/owntracks.nix
|
2022-08-06 16:07:29 +02:00
|
|
|
./services/immich.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
|
2022-05-29 17:26:10 +02:00
|
|
|
./services/calibre-web.nix
|
2020-09-27 14:27:25 +02:00
|
|
|
];
|
|
|
|
|
2022-05-06 15:48:57 +02:00
|
|
|
age.secrets.cloudflare.file = ./secrets/cloudflare.age;
|
2022-05-06 03:16:17 +02:00
|
|
|
age.secrets.hostKey.file = ./secrets/home-server/hostKey.age;
|
|
|
|
|
2020-09-27 14:27:25 +02:00
|
|
|
nixpkgs.config.allowUnfree = true;
|
|
|
|
|
2022-05-11 19:55:45 +02:00
|
|
|
# improve memory performance
|
|
|
|
zramSwap.enable = true;
|
|
|
|
zramSwap.algorithm = "zstd";
|
2022-05-14 18:10:48 +02:00
|
|
|
zramSwap.memoryPercent = 150;
|
2022-05-11 19:55:45 +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;
|
2022-06-04 12:28:32 +02:00
|
|
|
package = pkgs.ddclient.overrideAttrs (old: rec {
|
|
|
|
version = "develop-2022-06-01";
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "ddclient";
|
|
|
|
repo = "ddclient";
|
|
|
|
rev = "5382a982cbf4ad8e0c7b7ff682d21554a8785285";
|
|
|
|
sha256 = "sha256-LYQ65f1rLa1P/YNhrW7lbyhmViPO7odj7FcDGTS4bOo=";
|
|
|
|
};
|
|
|
|
preConfigure = ''
|
|
|
|
touch Makefile.PL
|
|
|
|
'';
|
|
|
|
installPhase = "";
|
|
|
|
postInstall = old.postInstall or "" + ''
|
|
|
|
mv $out/bin/ddclient $out/bin/.ddclient
|
|
|
|
makeWrapper $out/bin/.ddclient $out/bin/ddclient \
|
|
|
|
--prefix PERL5LIB : $PERL5LIB \
|
|
|
|
--argv0 ddclient
|
|
|
|
'';
|
|
|
|
nativeBuildInputs = with pkgs;
|
|
|
|
old.nativeBuildInputs or [ ] ++ [ autoreconfHook makeWrapper ];
|
|
|
|
});
|
2021-11-27 20:12:04 +01:00
|
|
|
protocol = "cloudflare";
|
|
|
|
ssl = true;
|
2022-06-04 12:28:32 +02:00
|
|
|
use = "disabled";
|
2021-11-27 20:12:04 +01:00
|
|
|
zone = "felschr.com";
|
|
|
|
username = "felschr@pm.me";
|
2022-05-06 15:48:57 +02:00
|
|
|
passwordFile = config.age.secrets.cloudflare.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"
|
2022-08-06 16:07:29 +02:00
|
|
|
"photos.felschr.com"
|
2022-05-29 17:26:10 +02:00
|
|
|
"books.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
|
|
|
];
|
2022-06-04 12:28:32 +02:00
|
|
|
extraConfig = with pkgs; ''
|
|
|
|
usev6=cmdv6, cmdv6=${
|
|
|
|
pkgs.writeScript "get-ipv6" ''
|
2022-08-03 03:15:06 +02:00
|
|
|
${iproute2}/bin/ip --brief addr show enp2s0 mngtmpaddr \
|
2022-06-04 12:28:32 +02:00
|
|
|
| ${gawk}/bin/awk '{print $(NF)}' \
|
|
|
|
| sed 's/\/.*//'
|
|
|
|
''
|
|
|
|
}
|
2022-06-26 13:26:11 +02:00
|
|
|
usev4=disabled
|
2022-06-04 12:28:32 +02: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"
|
2022-08-06 16:03:12 +02:00
|
|
|
boot.initrd.availableKernelModules = [ "igb" ];
|
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;
|
2022-05-15 15:45:00 +02:00
|
|
|
hostKeys = map (f: f.path) hostKeys;
|
2021-10-23 03:06:06 +02:00
|
|
|
authorizedKeys = config.users.users.felschr.openssh.authorizedKeys.keys;
|
|
|
|
};
|
2020-10-03 19:13:33 +02:00
|
|
|
};
|
2020-09-27 14:27:25 +02:00
|
|
|
|
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
|
2022-12-07 14:47:12 +01:00
|
|
|
system.stateVersion = "22.11";
|
2020-09-27 14:27:25 +02:00
|
|
|
}
|