diff --git a/hosts/dark-firepit/default.nix b/hosts/dark-firepit/default.nix index 4f937d7..11493d7 100644 --- a/hosts/dark-firepit/default.nix +++ b/hosts/dark-firepit/default.nix @@ -5,6 +5,7 @@ let in { imports = [ ./hardware-configuration.nix + ./yugoslavia-best.nix inputs.nix-minecraft.nixosModules.minecraft-servers #inputs.watch-party.nixosModules.watch-party (fetchTarball "https://github.com/msteen/nixos-vscode-server/tarball/master") @@ -20,12 +21,14 @@ in { ]; }; + users.groups.dotfiles = {}; + normalUsers = { aether = { conf = { packages = with pkgs; [ bat duf broot nftables tmux ]; shell = pkgs.unstable.fish; - extraGroups = [ "wheel" "nix-users" ]; + extraGroups = [ "wheel" "nix-users" "dotfiles" ]; initialHashedPassword = "!"; openssh.authorizedKeys.keys = [ keys."aether@subsurface".ssh ]; }; @@ -38,11 +41,12 @@ in { }; }; + # oatmealine ?? is that a reference to jill oatmealine monoids from the beloved videogame franchise "oateamelin jill monoids???" .oat. zone??? from va11hall-a??? video game???? woman????? minecraft??????? oatmealine = { conf = { packages = with pkgs; [ bat tmux micro direnv nix-direnv ripgrep ]; shell = pkgs.unstable.fish; - extraGroups = [ "wheel" "nix-users" ]; + extraGroups = [ "wheel" "nix-users" "dotfiles" ]; initialHashedPassword = "!"; openssh.authorizedKeys.keys = [ keys."oatmealine@void-defragmented".ssh keys."oatmealine@beppy-phone".ssh ]; }; @@ -168,7 +172,7 @@ in { "modfiles.oat.zone".dataDir = "/var/www/modfiles.oat.zone"; "shop.yugoslavia.best".dataDir = "/var/www/shop.yugoslavia.best"; "tesco-underground-dev.oat.zone".dataDir = "/var/www/tesco-underground-dev.oat.zone"; - "tesco-underground-dev.oat.zone".auth = { tesco = "Jn2DVTM7yVZtRKKyz3b2Tjj7Ss8vpuLB"; }; + "tesco-underground-dev.oat.zone".auth = { tesco = builtins.readFile /etc/tesco; }; "oat.zone".dataDir = "/var/www/oat.zone"; "oat.zone".php = true; "yugoslavia.fishing".dataDir = "/var/www/yugoslavia.fishing"; @@ -205,17 +209,12 @@ in { enable = true; port = 1995; }; - - yugoslavia-best = { - enable = true; - domain = "yugoslavia.best"; - }; }; }; services.nginx.virtualHosts."oat.zone" = { locations."/f/".extraConfig = '' - add_header Access-Control-Allow-Origin "*"; + add_header Access-Control-Allow-Origin "*"; ''; }; diff --git a/hosts/dark-firepit/yugoslavia-best.nix b/hosts/dark-firepit/yugoslavia-best.nix new file mode 100644 index 0000000..e1c6812 --- /dev/null +++ b/hosts/dark-firepit/yugoslavia-best.nix @@ -0,0 +1,118 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + domain = "yugoslavia.best"; + root = "/var/www/${domain}"; +in { + config = { + modules.services.staticSites.${domain} = { + dataDir = root; + php = true; + }; + + services = { + nginx.virtualHosts.${domain} = { + locations."/modding-txts/" = { + extraConfig = '' + autoindex on; + sub_filter + ''; + sub_filter
 ' ';
+            sub_filter 
' '; + sub_filter '' ''; + sub_filter '' '
'; + sub_filter '
'; + sub_filter
'
'; + sub_filter_once off; + ''; + }; + + locations."/srb2kaddons/" = { + extraConfig = '' + autoindex on; + alias /home/oatmealine/.srb2kart/firepit/; + sub_filter + ''; + sub_filter
 ' ';
+            sub_filter 
' '; + sub_filter '' ''; + sub_filter '' '
'; + sub_filter '
'; + sub_filter
'
'; + sub_filter_once off; + ''; + }; + + locations."/__special" = { + extraConfig = '' + internal; + allow all; + root ${root}/nginx/html/__special; + ''; + }; + + locations."= /__md_file" = { + extraConfig = '' + internal; + allow all; + + add_header 'Vary' 'Accept'; + + # redefining + add_header Strict-Transport-Security $hsts_header; + add_header Referrer-Policy origin-when-cross-origin; + add_header X-Content-Type-Options nosniff; + add_header X-XSS-Protection "1; mode=block"; + + sub_filter + '$request_filename - yugoslavia.best'; + sub_filter_once on; + + default_type text/html; + alias ${root}/nginx/html/__special/md-renderer.html; + ''; + }; + + locations."~* \\.md" = { + extraConfig = '' + error_page 418 = /__md_file; + + add_header 'Vary' 'Accept'; + + # redefining + add_header Strict-Transport-Security $hsts_header; + add_header Referrer-Policy origin-when-cross-origin; + add_header X-Content-Type-Options nosniff; + add_header X-XSS-Protection "1; mode=block"; + + if (!-f $request_filename) { + break; + } + + # if no "text/markdown" in "accept" header: + # redirect to /__md_file to serve html renderer + if ($http_accept !~* "text/markdown") { + return 418; + } + ''; + }; + + extraConfig = '' + types { + text/plain md; + text/html html; + text/plain txt; + text/css css; + application/javascript js; + image/x-icon ico; + image/png png; + image/gif gif; + } + ''; + }; + }; + }; +}