2024-05-14 19:21:19 +02:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
2024-03-15 10:46:02 +01:00
|
|
|
|
|
|
|
{
|
2024-05-14 19:21:19 +02:00
|
|
|
imports = [
|
|
|
|
./hardware-configuration.nix
|
|
|
|
];
|
2024-03-15 10:46:02 +01:00
|
|
|
|
2024-07-11 11:53:14 +02:00
|
|
|
boot.kernel.sysctl."net.ipv4.ip_forward" = true;
|
2024-03-15 10:46:02 +01:00
|
|
|
boot.loader.systemd-boot.enable = true;
|
|
|
|
boot.loader.efi.canTouchEfiVariables = true;
|
|
|
|
boot.supportedFilesystems = [ "bcachefs" ];
|
|
|
|
boot.kernelPackages = pkgs.linuxPackages_latest;
|
|
|
|
|
|
|
|
time.timeZone = "Europe/Paris";
|
|
|
|
|
|
|
|
i18n.defaultLocale = "en_US.UTF-8";
|
|
|
|
console = {
|
|
|
|
font = "Lat2-Terminus16";
|
|
|
|
keyMap = "fr";
|
|
|
|
};
|
|
|
|
services.dbus.packages = with pkgs; [ dconf ];
|
|
|
|
|
|
|
|
nixpkgs.config.allowUnfree = true;
|
|
|
|
|
|
|
|
programs.zsh.enable = true;
|
|
|
|
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
wget
|
|
|
|
brightnessctl
|
|
|
|
nix-search-cli
|
|
|
|
git
|
|
|
|
btop
|
|
|
|
ranger
|
|
|
|
dnsmasq
|
|
|
|
screen
|
|
|
|
];
|
|
|
|
|
|
|
|
programs.gnupg.agent = {
|
|
|
|
enable = true;
|
|
|
|
enableSSHSupport = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
services.openssh.enable = true;
|
2024-03-15 11:09:42 +01:00
|
|
|
services.netbird.enable = true;
|
2024-03-15 10:46:02 +01:00
|
|
|
|
2024-05-14 19:21:19 +02:00
|
|
|
boot.kernelModules = [
|
|
|
|
"kvm-intel"
|
|
|
|
"kvm-amd"
|
|
|
|
];
|
2024-03-20 10:07:21 +01:00
|
|
|
programs.virt-manager.enable = true;
|
|
|
|
virtualisation.libvirtd.enable = true;
|
|
|
|
|
2024-06-19 08:34:47 +02:00
|
|
|
security.acme = {
|
|
|
|
acceptTerms = true;
|
|
|
|
defaults.email = "root@katvayor.net";
|
|
|
|
};
|
2024-06-19 16:26:15 +02:00
|
|
|
services.nginx =
|
|
|
|
let
|
|
|
|
vhosts = {
|
|
|
|
"degette.katvayor.net" = {
|
|
|
|
vm = "192.168.122.2";
|
|
|
|
sshport = 22000;
|
|
|
|
};
|
|
|
|
"betamail.katvayor.net" = {
|
|
|
|
vm = "192.168.122.3";
|
|
|
|
sshport = 22002;
|
|
|
|
};
|
2024-07-18 14:47:43 +02:00
|
|
|
"catvayor.sh" = {
|
|
|
|
vm = "192.168.122.3";
|
|
|
|
sshport = null;
|
|
|
|
};
|
2024-07-11 11:53:14 +02:00
|
|
|
"traque.dgnum.eu" = {
|
|
|
|
vm = "192.168.122.4";
|
|
|
|
sshport = null;
|
|
|
|
};
|
2024-06-19 16:26:15 +02:00
|
|
|
"traque.katvayor.net" = {
|
|
|
|
vm = "192.168.122.4";
|
|
|
|
sshport = 22001;
|
|
|
|
};
|
2024-06-23 15:57:17 +02:00
|
|
|
"test.traque.katvayor.net" = {
|
|
|
|
vm = "192.168.122.4";
|
|
|
|
sshport = null;
|
|
|
|
};
|
2024-06-25 10:54:31 +02:00
|
|
|
"son.katvayor.net" = {
|
|
|
|
vm = "192.168.122.5";
|
|
|
|
sshport = null;
|
|
|
|
};
|
2024-08-07 17:26:34 +02:00
|
|
|
"orchid.katvayor.net" = {
|
|
|
|
vm = "192.168.122.6";
|
|
|
|
sshport = 22042;
|
|
|
|
};
|
2024-06-19 16:26:15 +02:00
|
|
|
};
|
|
|
|
in
|
2024-06-21 13:46:57 +02:00
|
|
|
{
|
|
|
|
enable = true;
|
2024-06-27 18:39:21 +02:00
|
|
|
virtualHosts =
|
|
|
|
let
|
|
|
|
manah-webroot = pkgs.runCommand "manah" { } ''
|
|
|
|
mkdir -p $out/.kat-manah/
|
|
|
|
ln -nsf ${./error} $out/.kat-manah/error
|
|
|
|
'';
|
|
|
|
in
|
2024-06-21 13:46:57 +02:00
|
|
|
{
|
2024-06-27 18:39:21 +02:00
|
|
|
"manah.katvayor.net" = {
|
|
|
|
default = true;
|
|
|
|
enableACME = true;
|
|
|
|
addSSL = true;
|
|
|
|
locations = {
|
|
|
|
"/.kat-manah" = {
|
|
|
|
extraConfig = ''
|
|
|
|
internal;
|
|
|
|
error_page 404 =418 /.kat-manah/error/418.html;
|
|
|
|
'';
|
|
|
|
root = manah-webroot;
|
|
|
|
};
|
|
|
|
"/" = {
|
|
|
|
extraConfig = ''
|
|
|
|
return 418;
|
|
|
|
error_page 418 =418 /.kat-manah/error/418.html;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
2024-06-21 13:46:57 +02:00
|
|
|
};
|
|
|
|
}
|
2024-06-27 18:39:21 +02:00
|
|
|
// builtins.mapAttrs (
|
|
|
|
_:
|
|
|
|
{ vm, ... }:
|
|
|
|
{
|
|
|
|
enableACME = true;
|
|
|
|
addSSL = true;
|
|
|
|
acmeFallbackHost = vm;
|
|
|
|
acmeFallbackRecommendedProxySettings = true;
|
|
|
|
locations = {
|
|
|
|
"/.kat-manah" = {
|
|
|
|
extraConfig = ''
|
|
|
|
internal;
|
|
|
|
error_page 404 =418 /.kat-manah/error/418.html;
|
|
|
|
'';
|
|
|
|
root = manah-webroot;
|
|
|
|
};
|
|
|
|
"/" = {
|
|
|
|
recommendedProxySettings = true;
|
|
|
|
proxyPass = "https://${vm}/";
|
|
|
|
extraConfig = ''
|
|
|
|
proxy_set_header Connection ''';
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
chunked_transfer_encoding off;
|
|
|
|
proxy_buffering off;
|
|
|
|
proxy_cache off;
|
|
|
|
error_page 502 =599 "/.kat-manah/error/599.html";
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
) vhosts;
|
2024-06-21 13:46:57 +02:00
|
|
|
streamConfig =
|
|
|
|
builtins.concatStringsSep "\n" (
|
|
|
|
lib.mapAttrsToList (
|
|
|
|
vhost:
|
|
|
|
{ vm, sshport }:
|
2024-06-23 15:57:17 +02:00
|
|
|
lib.optionalString (!isNull sshport) ''
|
2024-06-21 13:46:57 +02:00
|
|
|
server {
|
|
|
|
listen ${toString sshport};
|
|
|
|
proxy_pass ${vm}:22;
|
|
|
|
}
|
|
|
|
''
|
|
|
|
) vhosts
|
|
|
|
)
|
|
|
|
+ ''
|
2024-06-19 16:26:15 +02:00
|
|
|
server {
|
2024-06-21 13:46:57 +02:00
|
|
|
listen 993;
|
|
|
|
proxy_pass 192.168.122.3:993;
|
2024-06-19 16:26:15 +02:00
|
|
|
}
|
2024-06-21 13:46:57 +02:00
|
|
|
server {
|
|
|
|
listen 465;
|
|
|
|
proxy_pass 192.168.122.3:465;
|
|
|
|
}
|
2024-07-18 14:47:43 +02:00
|
|
|
server {
|
|
|
|
listen 25;
|
|
|
|
proxy_pass 192.168.122.3:25;
|
|
|
|
}
|
2024-06-21 13:46:57 +02:00
|
|
|
'';
|
|
|
|
};
|
2024-03-27 17:35:34 +01:00
|
|
|
|
2024-06-18 09:47:57 +02:00
|
|
|
networking.firewall = {
|
|
|
|
allowedTCPPorts = [
|
|
|
|
22
|
2024-07-18 14:47:43 +02:00
|
|
|
25
|
2024-06-18 09:47:57 +02:00
|
|
|
53
|
|
|
|
80
|
|
|
|
443
|
2024-06-21 13:46:57 +02:00
|
|
|
465
|
|
|
|
993
|
2024-06-18 09:47:57 +02:00
|
|
|
];
|
|
|
|
allowedTCPPortRanges = [
|
|
|
|
{
|
|
|
|
from = 22000;
|
|
|
|
to = 22100;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
allowedUDPPorts = [ 67 ];
|
|
|
|
};
|
2024-06-27 18:39:21 +02:00
|
|
|
system.stateVersion = "23.11";
|
2024-03-15 10:46:02 +01:00
|
|
|
}
|