2024-05-03 23:10:55 +05:00
|
|
|
{ config, pkgs, lib, self, ... }:
|
|
|
|
let bonfire-pkgs = self.packages.${pkgs.system};
|
|
|
|
in {
|
2024-01-06 18:06:02 +05:00
|
|
|
system.stateVersion = "23.11";
|
|
|
|
|
2024-01-25 18:09:52 +05:00
|
|
|
imports = [
|
2024-05-03 23:10:55 +05:00
|
|
|
./hardware.nix
|
|
|
|
./users.nix
|
2024-01-25 18:09:52 +05:00
|
|
|
./services/papermc.nix
|
|
|
|
./services/gitea.nix
|
|
|
|
];
|
2024-01-06 18:06:02 +05:00
|
|
|
|
|
|
|
# Nix settings
|
|
|
|
nix = {
|
|
|
|
settings = {
|
|
|
|
experimental-features = [ "nix-command" "flakes" ];
|
2024-04-26 17:05:21 +05:00
|
|
|
trusted-users = [ "l-nafaryus" ];
|
|
|
|
allowed-users = [ "l-nafaryus" ];
|
2024-01-06 18:06:02 +05:00
|
|
|
substituters = [ "https://nix-community.cachix.org" ];
|
|
|
|
trusted-public-keys = [
|
|
|
|
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
|
|
|
];
|
|
|
|
auto-optimise-store = true;
|
|
|
|
};
|
|
|
|
gc = {
|
|
|
|
automatic = lib.mkDefault true;
|
|
|
|
dates = lib.mkDefault "weekly";
|
|
|
|
options = lib.mkDefault "--delete-older-than 14d";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# Nix packages
|
|
|
|
nixpkgs = {
|
|
|
|
hostPlatform = lib.mkDefault "x86_64-linux";
|
|
|
|
config.allowUnfree = true;
|
|
|
|
config.cudaSupport = false;
|
2024-01-16 01:43:51 +05:00
|
|
|
config.packageOverrides = super: {
|
2024-05-03 23:10:55 +05:00
|
|
|
lego = bonfire-pkgs.lego;
|
2024-01-16 01:43:51 +05:00
|
|
|
};
|
2024-01-06 18:06:02 +05:00
|
|
|
};
|
|
|
|
|
|
|
|
# Services
|
|
|
|
services.printing.enable = true;
|
|
|
|
|
|
|
|
services.pipewire = {
|
|
|
|
enable = true;
|
|
|
|
alsa.enable = true;
|
|
|
|
alsa.support32Bit = true;
|
|
|
|
pulse.enable = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
services.openssh = {
|
|
|
|
enable = true;
|
|
|
|
startWhenNeeded = true;
|
2024-01-16 01:43:51 +05:00
|
|
|
settings.PasswordAuthentication = false;
|
2024-02-09 19:14:20 +05:00
|
|
|
settings.KbdInteractiveAuthentication = false;
|
2024-01-06 18:06:02 +05:00
|
|
|
};
|
|
|
|
|
|
|
|
services.blueman.enable = true;
|
|
|
|
|
2024-01-16 01:43:51 +05:00
|
|
|
services.fail2ban = {
|
|
|
|
enable = true;
|
2024-01-19 19:59:45 +05:00
|
|
|
maxretry = 12;
|
2024-01-16 01:43:51 +05:00
|
|
|
ignoreIP = [
|
|
|
|
"192.168.0.0/16"
|
|
|
|
];
|
2024-01-19 19:59:45 +05:00
|
|
|
bantime = "3h";
|
2024-01-16 01:43:51 +05:00
|
|
|
bantime-increment = {
|
|
|
|
enable = true;
|
2024-01-16 13:05:15 +05:00
|
|
|
multipliers = "1 2 4 8 16 32 64";
|
2024-01-16 01:43:51 +05:00
|
|
|
maxtime = "168h";
|
|
|
|
overalljails = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-01-19 19:59:45 +05:00
|
|
|
sops = {
|
|
|
|
defaultSopsFile = ../../.secrets/secrets.yaml;
|
|
|
|
age.keyFile = "/var/lib/secrets/sops-nix/catarina.txt";
|
|
|
|
secrets = import ../../.secrets/sops-secrets.nix;
|
|
|
|
};
|
|
|
|
|
2024-01-16 01:43:51 +05:00
|
|
|
security.acme = {
|
|
|
|
acceptTerms = true;
|
2024-02-29 16:15:16 +05:00
|
|
|
defaults.email = "l.nafaryus@elnafo.ru";
|
2024-01-16 01:43:51 +05:00
|
|
|
defaults.group = "nginx";
|
|
|
|
|
|
|
|
certs = {
|
|
|
|
"elnafo.ru" = {
|
2024-02-29 16:15:16 +05:00
|
|
|
extraDomainNames = [ "*.elnafo.ru" ];
|
2024-01-16 01:43:51 +05:00
|
|
|
dnsProvider = "webnames";
|
2024-01-19 19:59:45 +05:00
|
|
|
credentialsFile = config.sops.secrets."dns".path;
|
2024-01-16 01:43:51 +05:00
|
|
|
webroot = null;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-01-25 18:09:52 +05:00
|
|
|
|
2024-01-09 19:26:30 +05:00
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
2024-01-16 01:43:51 +05:00
|
|
|
|
2024-01-19 19:59:45 +05:00
|
|
|
package = pkgs.nginx.override { withMail = true; };
|
|
|
|
|
2024-01-09 19:26:30 +05:00
|
|
|
recommendedProxySettings = true;
|
2024-01-16 01:43:51 +05:00
|
|
|
recommendedOptimisation = true;
|
|
|
|
recommendedGzipSettings = true;
|
|
|
|
recommendedTlsSettings = true;
|
|
|
|
|
2024-03-11 13:11:48 +05:00
|
|
|
clientMaxBodySize = "5G";
|
|
|
|
|
2024-01-16 01:43:51 +05:00
|
|
|
virtualHosts = {
|
|
|
|
"elnafo.ru" = {
|
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
root = "/var/www";
|
|
|
|
};
|
|
|
|
|
|
|
|
"www.elnafo.ru" = {
|
|
|
|
forceSSL = true;
|
|
|
|
useACMEHost = "elnafo.ru";
|
|
|
|
globalRedirect = "elnafo.ru";
|
|
|
|
};
|
|
|
|
|
2024-01-19 19:59:45 +05:00
|
|
|
"media.elnafo.ru" = {
|
|
|
|
forceSSL = true;
|
|
|
|
useACMEHost = "elnafo.ru";
|
|
|
|
http2 = true;
|
|
|
|
locations."/".proxyPass = "http://127.0.0.1:8096";
|
|
|
|
};
|
2024-01-16 01:43:51 +05:00
|
|
|
};
|
2024-01-16 12:58:07 +05:00
|
|
|
};
|
|
|
|
|
2024-01-19 19:59:45 +05:00
|
|
|
mailserver = {
|
|
|
|
enable = true;
|
|
|
|
fqdn = "elnafo.ru";
|
|
|
|
domains = [ "elnafo.ru" ];
|
|
|
|
|
|
|
|
certificateScheme = "acme-nginx";
|
|
|
|
enableImapSsl = true;
|
|
|
|
openFirewall = true;
|
2024-02-29 16:15:16 +05:00
|
|
|
localDnsResolver = true;
|
2024-01-19 19:59:45 +05:00
|
|
|
|
|
|
|
loginAccounts = import ../../.secrets/mail-recipients.nix { inherit config; };
|
|
|
|
};
|
|
|
|
|
|
|
|
services.jellyfin = {
|
2024-03-26 15:33:02 +05:00
|
|
|
enable = false;
|
2024-01-19 19:59:45 +05:00
|
|
|
openFirewall = true;
|
|
|
|
};
|
|
|
|
|
2024-01-06 18:06:02 +05:00
|
|
|
services.spoofdpi.enable = true;
|
|
|
|
|
2024-04-03 22:24:18 +05:00
|
|
|
services.btrfs.autoScrub = {
|
|
|
|
enable = true;
|
|
|
|
interval = "monthly";
|
|
|
|
fileSystems = [ "/" ];
|
2024-03-22 23:21:25 +05:00
|
|
|
};
|
|
|
|
|
2024-04-03 22:24:18 +05:00
|
|
|
services.btrbk = {
|
|
|
|
instances."catarina" = {
|
|
|
|
onCalendar = "daily";
|
|
|
|
|
|
|
|
settings = {
|
|
|
|
snapshot_preserve_min = "2d";
|
|
|
|
snapshot_preserve = "14d";
|
|
|
|
snapshot_dir = "/media/btrbk-snapshots";
|
|
|
|
target_preserve_min = "no";
|
|
|
|
target_preserve = "14d 8w *m";
|
|
|
|
|
|
|
|
volume."/" = {
|
|
|
|
target = "/media/btrbk-backups";
|
|
|
|
subvolume = {
|
|
|
|
"var/lib/gitea" = {};
|
|
|
|
"var/lib/postgresql" = {};
|
|
|
|
"var/lib/postfix" = {};
|
|
|
|
"var/vmail" = {};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.transmission = {
|
|
|
|
enable = true;
|
|
|
|
openRPCPort = true;
|
|
|
|
settings = {
|
|
|
|
rpc-bind-address = "0.0.0.0";
|
|
|
|
rpc-whitelist = "127.0.0.1,192.168.156.101";
|
|
|
|
download-dir = "/media/storage/downloads";
|
|
|
|
incomplete-dir = "/media/storage/downloads/incomplete";
|
|
|
|
};
|
|
|
|
};
|
2024-02-29 16:15:16 +05:00
|
|
|
|
2024-04-26 17:05:21 +05:00
|
|
|
services.oscuro = {
|
|
|
|
enable = true;
|
|
|
|
discordTokenFile = config.sops.secrets.discordToken.path;
|
|
|
|
};
|
|
|
|
|
2024-05-03 23:10:55 +05:00
|
|
|
virtualisation = {
|
|
|
|
containers.enable = true;
|
|
|
|
podman = {
|
|
|
|
enable = true;
|
|
|
|
dockerCompat = true;
|
|
|
|
defaultNetwork.settings.dns_enabled = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-01-06 18:06:02 +05:00
|
|
|
# Packages
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
wget
|
|
|
|
|
|
|
|
ntfs3g
|
|
|
|
sshfs
|
|
|
|
exfat
|
2024-02-29 16:15:16 +05:00
|
|
|
btrfs-progs
|
2024-04-03 22:24:18 +05:00
|
|
|
btrbk
|
2024-01-06 18:06:02 +05:00
|
|
|
|
|
|
|
lm_sensors
|
|
|
|
|
|
|
|
git
|
|
|
|
ripgrep
|
|
|
|
fd
|
|
|
|
lazygit
|
|
|
|
unzip
|
|
|
|
|
|
|
|
gnumake
|
|
|
|
|
|
|
|
fishPlugins.fzf-fish
|
|
|
|
fishPlugins.tide
|
|
|
|
fishPlugins.grc
|
|
|
|
fishPlugins.hydro
|
|
|
|
|
|
|
|
nnn
|
|
|
|
fzf
|
|
|
|
grc
|
|
|
|
|
|
|
|
gcc
|
|
|
|
|
|
|
|
cachix
|
|
|
|
|
|
|
|
gnupg
|
|
|
|
nnn
|
|
|
|
htop
|
|
|
|
];
|
|
|
|
|
|
|
|
programs = {
|
|
|
|
fish.enable = true;
|
|
|
|
|
|
|
|
neovim = {
|
|
|
|
enable = true;
|
|
|
|
defaultEditor = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-01-10 22:32:33 +05:00
|
|
|
programs.ssh.extraConfig = ''
|
|
|
|
Host astora
|
|
|
|
HostName 192.168.156.101
|
|
|
|
Port 22
|
2024-04-26 17:05:21 +05:00
|
|
|
User l-nafaryus
|
2024-01-10 22:32:33 +05:00
|
|
|
|
|
|
|
Host catarina
|
|
|
|
HostName 192.168.156.102
|
|
|
|
Port 22
|
2024-04-26 17:05:21 +05:00
|
|
|
User l-nafaryus
|
2024-01-10 22:32:33 +05:00
|
|
|
'';
|
|
|
|
|
2024-01-06 18:06:02 +05:00
|
|
|
programs.direnv.enable = true;
|
|
|
|
}
|