1
0
Fork 0
dotfiles/system/nixos/websites-tanker.nix

179 lines
5.5 KiB
Nix
Raw Permalink Normal View History

2022-12-01 14:51:08 +00:00
{ pkgs, ... }:
2023-10-21 18:43:00 +00:00
let
kempkens-io = pkgs.stdenvNoCC.mkDerivation {
pname = "website-kempkens-io";
version = "2023-09-18";
src = pkgs.fetchFromGitea {
domain = "git.kempkens.io";
owner = "daniel";
repo = "kempkens.io";
2024-08-18 17:34:31 +00:00
rev = "da5e8119f0228f0fbffc06193f17b8148229affb";
hash = "sha256-F/i8ADHTEZZurrs0QFCvP/wBhz0im2jDXErg8sImlAI=";
2023-10-21 18:43:00 +00:00
fetchSubmodules = true;
};
nativeBuildInputs = with pkgs; [ brotli hugo ];
installPhase = ''
mkdir $out
hugo
find public -type f -regextype posix-extended -iregex '.*\.(css|js|json|html|txt|woff|woff2|xml)' \
-exec gzip --best --keep {} ';'
find public -type f -regextype posix-extended -iregex '.*\.(css|js|json|html|txt|woff|woff2|xml)' \
-exec brotli --best --keep {} ';'
mv public $out/
'';
};
blog-kempkens-io = pkgs.stdenvNoCC.mkDerivation {
pname = "website-blog-kempkens-io";
2024-10-07 08:19:13 +00:00
version = "2024-10-05";
2023-10-21 18:43:00 +00:00
src = pkgs.fetchFromGitea {
domain = "git.kempkens.io";
owner = "daniel";
repo = "blog.kempkens.io";
2024-10-07 08:19:13 +00:00
rev = "4b38edfc4f2b606f001ae046a84bd46fc9e4078e";
hash = "sha256-VaJxlCix8JoQViC5PHZMlEpsqkjgRQNRUcIXQxs9JWk=";
2023-10-21 18:43:00 +00:00
fetchSubmodules = true;
};
nativeBuildInputs = with pkgs; [ brotli hugo ];
installPhase = ''
mkdir $out
hugo
find public -type f -regextype posix-extended -iregex '.*\.(css|js|json|html|txt|woff|woff2|xml)' \
-exec gzip --best --keep {} ';'
find public -type f -regextype posix-extended -iregex '.*\.(css|js|json|html|txt|woff|woff2|xml)' \
-exec brotli --best --keep {} ';'
mv public $out/
'';
};
docs-nifoc-pw = pkgs.stdenvNoCC.mkDerivation {
pname = "website-docs-nifoc-pw";
version = "2021-08-30";
src = pkgs.fetchFromGitHub {
owner = "nifoc";
repo = "nifoc.pw-docs";
rev = "24034da912e3d7fddc447734ca4c9a5951a0fa32";
sha256 = "sha256-GwVwbLUbxpFidOU1CTHFbYs/MscHpsqiYmnyvLtnYjM=";
fetchSubmodules = false;
};
nativeBuildInputs = with pkgs; [ brotli ];
installPhase = ''
mkdir $out
find site -type f -regextype posix-extended -iregex '.*\.(css|js|json|html|txt|woff|woff2|xml)' \
-exec gzip --best --keep {} ';'
find site -type f -regextype posix-extended -iregex '.*\.(css|js|json|html|txt|woff|woff2|xml)' \
-exec brotli --best --keep {} ';'
mv site $out/
'';
};
in
2022-12-01 14:51:08 +00:00
{
services.nginx = {
2023-10-21 18:43:00 +00:00
virtualHosts = {
# kempkens.io
"kempkens.io" = {
quic = true;
http3 = true;
kTLS = true;
root = "${kempkens-io}/public";
forceSSL = true;
useACMEHost = "kempkens.io";
extraConfig = ''
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
add_header X-Frame-Options DENY;
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options nosniff;
add_header Referrer-Policy no-referrer;
add_header Content-Security-Policy "default-src 'none'; manifest-src https://kempkens.io; script-src 'self'; img-src 'self'; style-src 'self' 'unsafe-inline' https://cdnjs.cloudflare.com; font-src 'self'; form-action 'none'; frame-ancestors 'none'; base-uri 'self'";
'';
locations = {
"/id".return = "307 https://keyoxide.org/028BCE9BABB5145AAAA1FB8410BE1D47E5ADFF92";
"/.well-known/host-meta".return = "301 https://mastodon.kempkens.io/.well-known/host-meta";
"/.well-known/webfinger".return = "301 https://mastodon.kempkens.io$request_uri";
"/.well-known/matrix/server".extraConfig = ''
default_type application/json;
'';
"/.well-known/matrix/client".extraConfig = ''
default_type application/json;
'';
};
};
"www.kempkens.io" = {
quic = true;
http3 = true;
addSSL = true;
useACMEHost = "kempkens.io";
extraConfig = ''
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
'';
globalRedirect = "kempkens.io";
};
# blog.kempkens.io
"blog.kempkens.io" = {
quic = true;
http3 = true;
kTLS = true;
root = "${blog-kempkens-io}/public";
forceSSL = true;
useACMEHost = "kempkens.io";
extraConfig = ''
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
add_header X-Frame-Options DENY;
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options nosniff;
add_header Referrer-Policy no-referrer;
add_header Content-Security-Policy "default-src 'none'; manifest-src https://blog.kempkens.io; script-src 'self'; img-src 'self'; style-src 'self' 'unsafe-inline'; font-src 'self'; form-action 'none'; frame-ancestors 'none'; base-uri 'self'";
'';
};
} // builtins.listToAttrs (builtins.map
# Documentation
2022-12-01 14:51:08 +00:00
(domain: {
name = domain;
value = {
2023-04-03 13:03:52 +00:00
quic = true;
2023-03-06 11:06:59 +00:00
http3 = true;
2023-03-07 09:02:50 +00:00
kTLS = true;
2022-12-26 17:17:59 +00:00
2023-10-21 18:43:00 +00:00
root = "${docs-nifoc-pw}/site/${domain}";
2023-03-06 11:06:59 +00:00
forceSSL = true;
useACMEHost = "nifoc.pw";
2022-12-26 17:17:59 +00:00
2022-12-01 14:51:08 +00:00
extraConfig = ''
autoindex on;
autoindex_format html;
'';
};
2022-12-01 15:21:38 +00:00
}) [ "katja.nifoc.pw" "katja_vmstats.nifoc.pw" "noesis.nifoc.pw" "propagator.nifoc.pw" ]);
2022-12-01 14:51:08 +00:00
};
}