infra/pastila/srv.nix

38 lines
836 B
Nix
Raw Normal View History

2024-06-01 10:53:00 +00:00
{ config, lib, pkgs, ... }:
2024-06-01 17:19:37 +00:00
let
up_dir = /srv/up;
in
2024-06-01 10:53:00 +00:00
{
services.nginx.enable = true;
2024-06-01 16:45:55 +00:00
# nginx runs under ProtectHome=true which disallows reading anywhere
# in /home. So we need to use a different location.
2024-06-01 10:53:00 +00:00
users.users."up" = {
isNormalUser = true;
2024-06-01 17:19:37 +00:00
home = up_dir;
2024-06-01 17:34:21 +00:00
# group = config.services.nginx.group;
group = "nginx";
2024-06-01 17:19:37 +00:00
# Unsure why this is broken, but couldn't make things work without
# creating the directory by hand.
# createHome = true;
# homeMode = "750";
2024-06-01 10:53:00 +00:00
};
services.nginx.virtualHosts."srv.isomorphis.me" = {
forceSSL = true;
enableACME = true;
2024-06-01 17:19:37 +00:00
root = up_dir;
locations ={
"/" = {
extraConfig = "autoindex on;";
};
"/.ssh" = {
return = "403";
};
"/i/" = {
extraConfig = "autoindex off;";
};
2024-06-01 10:53:00 +00:00
};
};
}