nixcfg/hosts/mauville/default.nix

230 lines
6 KiB
Nix
Raw Normal View History

2024-03-12 22:14:08 -04:00
# Custom desktop with AMD Ryzen 5 2600, 16GB RAM, AMD Rx 6700, and 1TB SSD + 2TB HDD.
{
2024-04-07 22:16:33 -04:00
config,
input,
2024-04-07 22:16:33 -04:00
lib,
pkgs,
self,
2024-04-07 22:16:33 -04:00
...
}: let
acmeEmail = "alyraffauf@gmail.com";
hostName = "mauville";
domain = "raffauflabs.com";
mediaDirectory = "/mnt/Media";
archiveDirectory = "/mnt/Archive";
in {
imports = [
2024-05-27 21:39:30 -04:00
./hardware.nix
./home.nix
self.nixosModules.default
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = hostName; # Define your hostname.
alyraffauf = {
apps = {
2024-06-03 14:06:24 -04:00
nicotine-plus.enable = true;
podman.enable = true;
2024-06-03 14:06:24 -04:00
steam.enable = true;
virt-manager.enable = true;
};
containers = {
nixos = {
navidrome.enable = true;
};
oci = {
audiobookshelf.enable = true;
freshRSS.enable = true;
2024-05-16 09:28:39 -04:00
jellyfin.enable = false;
plexMediaServer.enable = true;
transmission.enable = true;
};
};
desktop = {
enable = true;
2024-04-28 21:57:06 -04:00
greetd = {
enable = true;
session = lib.getExe config.programs.hyprland.package;
autologin = {
enable = true;
user = "aly";
};
2024-04-28 21:57:06 -04:00
};
2024-05-26 12:24:39 -04:00
hyprland.enable = true;
2024-04-28 21:57:06 -04:00
sway.enable = true;
};
user = {
2024-04-26 22:55:43 -04:00
aly = {
enable = true;
password = "$y$j9T$SHPShqI2IpRE101Ey2ry/0$0mhW1f9LbVY02ifhJlP9XVImge9HOpf23s9i1JFLIt9";
};
dustin = {
enable = true;
password = "$y$j9T$3mMCBnUQ.xjuPIbSof7w0.$fPtRGblPRSwRLj7TFqk1nzuNQk2oVlgvb/bE47sghl.";
};
};
services = {
binaryCache.enable = true;
2024-04-23 21:24:05 -04:00
ollama = {
enable = true;
2024-04-27 10:51:59 -04:00
gpu = "amd";
2024-04-23 21:24:05 -04:00
listenAddress = "0.0.0.0:11434";
};
2024-04-26 22:38:29 -04:00
syncthing = {
enable = true;
syncMusic = true;
2024-05-27 21:39:30 -04:00
musicPath = "${mediaDirectory}/Music";
2024-04-26 22:38:29 -04:00
};
2024-04-30 14:53:17 -04:00
tailscale.enable = true;
};
2024-05-02 09:08:35 -04:00
scripts = {
hoenn.enable = true;
};
system = {
plymouth.enable = true;
zramSwap = {
enable = true;
size = 100;
};
};
};
networking = {
2024-04-22 21:49:08 -04:00
firewall = let
transmissionPort = config.alyraffauf.containers.oci.transmission.port;
bitTorrentPort = config.alyraffauf.containers.oci.transmission.bitTorrentPort;
in {
allowedTCPPorts = [80 443 transmissionPort bitTorrentPort];
allowedUDPPorts = [bitTorrentPort];
};
# My router doesn't expose settings for NAT loopback
# So we have to use this workaround.
extraHosts = ''
127.0.0.1 music.${domain}
2024-06-07 13:14:34 -04:00
127.0.0.1 news.${domain}
127.0.0.1 nixcache.${domain}
127.0.0.1 plex.${domain}
127.0.0.1 podcasts.${domain}
'';
};
security.acme = {
acceptTerms = true;
defaults.email = acmeEmail;
};
services = {
2024-05-24 19:28:13 -04:00
fail2ban.enable = true;
nginx = {
enable = true;
2024-06-07 13:14:34 -04:00
recommendedGzipSettings = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
2024-06-07 13:14:34 -04:00
virtualHosts = {
"music.${domain}" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:4533";
proxyWebsockets = true;
extraConfig = ''
proxy_buffering off;
'';
};
};
2024-06-07 13:14:34 -04:00
"news.${domain}" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:${toString config.alyraffauf.containers.oci.freshRSS.port}";
proxyWebsockets = true; # needed if you need to use WebSocket
extraConfig = ''
proxy_buffering off;
proxy_redirect off;
# Forward the Authorization header for the Google Reader API.
proxy_pass_header Authorization;
proxy_set_header Authorization $http_authorization;
'';
};
};
2024-06-07 13:14:34 -04:00
"nixcache.${domain}" = {
enableACME = true;
forceSSL = true;
locations."/".proxyPass = "http://${config.services.nix-serve.bindAddress}:${
toString config.services.nix-serve.port
}";
};
2024-06-07 13:14:34 -04:00
"plex.${domain}" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:${toString config.alyraffauf.containers.oci.plexMediaServer.port}";
proxyWebsockets = true;
extraConfig = ''
proxy_buffering off;
'';
};
};
2024-06-07 13:14:34 -04:00
"podcasts.${domain}" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:${toString config.alyraffauf.containers.oci.audiobookshelf.port}";
# proxyWebsockets = true; # This breaks audiobookshelf.
extraConfig = ''
client_max_body_size 500M;
proxy_buffering off;
proxy_redirect http:// https://;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Connection "upgrade";
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
'';
};
};
};
};
samba = {
enable = true;
securityType = "user";
openFirewall = true;
shares = {
Media = {
2024-06-07 13:14:34 -04:00
browseable = "yes";
comment = "Media @ ${hostName}";
path = mediaDirectory;
"read only" = "no";
"guest ok" = "yes";
"create mask" = "0755";
"directory mask" = "0755";
};
Archive = {
2024-06-07 13:14:34 -04:00
browseable = "yes";
comment = "Archive @ ${hostName}";
path = archiveDirectory;
"create mask" = "0755";
"directory mask" = "0755";
2024-06-07 13:14:34 -04:00
"guest ok" = "yes";
"read only" = "no";
};
};
};
samba-wsdd = {
enable = true;
openFirewall = true;
};
};
2024-03-16 13:23:59 -04:00
system.stateVersion = "23.11";
}