preparations for the new website

pull/56/head
Tudor Roman 2024-01-22 18:23:28 +01:00
parent caa3075068
commit 659c037f83
Signed by: tudor
SSH Key Fingerprint: SHA256:3CwS9plgXBecpXImPGxDIaSktUXBejbV/zerZMqzzBk
2 changed files with 22 additions and 8 deletions

View File

@ -1,4 +1,4 @@
{ config, pkgs, lib, vars, ...}:
{ config, ...}:
{
imports = [ ../_all ./hardware.nix ];
@ -11,7 +11,10 @@
nginx.enable = true;
cgit.enable = false;
gitea.enable = true;
site.enable = true;
site = {
enable = true;
webRootUser = "tudor";
};
yarr.enable = true;
};
ipforward.enable = true;

View File

@ -5,6 +5,16 @@ in
with lib; {
options.systemModules.services.web.site = {
enable = mkEnableOption "site";
webRoot = mkOption {
description = "Website webroot";
type = types.str;
default = "/srv/site";
};
webRootUser = mkOption {
description = "User who places files in webroot";
type = types.str;
default = "";
};
};
config = mkIf cfg.enable {
@ -17,6 +27,12 @@ with lib; {
})
];
systemd.tmpfiles.rules =
assert cfg.webRootUser != "";
[
"d ${cfg.webRoot} 2755 ${cfg.webRootUser} nginx -"
];
services.nginx.virtualHosts."tudorr.ro" = {
forceSSL = true;
enableACME = true;
@ -25,12 +41,7 @@ with lib; {
locations = {
"/" = {
alias = "${pkgs.tudor.site}/";
index = "index.html";
};
"/blog/" = {
alias = "${pkgs.tudor.blog}/";
alias = "${cfg.webRoot}/";
index = "index.html";
};
};