mirror of
https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git
synced 2026-08-11 05:42:33 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2bb0d725fc |
@@ -1,70 +1,25 @@
|
|||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
{
|
{
|
||||||
# TODO: move this to base so that all virtualHosts take effect on their respecitve hosts
|
services.nginx.virtualHosts = lib.genAttrs [
|
||||||
|
|
||||||
# NOTE: automatically hosting well-known files by looping over all existing `virtualHosts`
|
|
||||||
# unfortunately causes infinite recursuion due to submodule usage within the nginx
|
|
||||||
# module. For now, the easiest solution was to manually specify a list of virtualHosts
|
|
||||||
# here, but it would be nice to find a better solution in the future.
|
|
||||||
services.nginx.virtualHosts = lib.mkMerge [
|
|
||||||
(lib.genAttrs [
|
|
||||||
"pvv.ntnu.no"
|
"pvv.ntnu.no"
|
||||||
"pvv.org"
|
|
||||||
|
|
||||||
"www.pvv.ntnu.no"
|
"www.pvv.ntnu.no"
|
||||||
"www.pvv.org"
|
|
||||||
"www2.pvv.ntnu.no"
|
|
||||||
"www2.pvv.org"
|
|
||||||
|
|
||||||
# NOTE: this list is probably not complete
|
|
||||||
"alps.pvv.ntnu.no"
|
|
||||||
"chat.pvv.ntnu.no"
|
|
||||||
"grafana.pvv.ntnu.no"
|
|
||||||
"status.pvv.ntnu.no"
|
|
||||||
"matrix.pvv.ntnu.no"
|
|
||||||
"mirrors.pvv.ntnu.no"
|
|
||||||
"pages.pvv.ntnu.no"
|
|
||||||
"ooye.pvv.ntnu.no"
|
|
||||||
"ooye.pvv.ntnu.no"
|
|
||||||
"dav.pvv.ntnu.no"
|
|
||||||
"git.pvv.ntnu.no"
|
|
||||||
"idp.pvv.ntnu.no"
|
|
||||||
"minecraft.pvv.ntnu.no"
|
|
||||||
"pw.pvv.ntnu.no"
|
|
||||||
"snappymail.pvv.ntnu.no"
|
|
||||||
"webmail.pvv.ntnu.no"
|
|
||||||
"wiki.pvv.ntnu.no"
|
|
||||||
] (_: {
|
|
||||||
locations."^~ /.well-known/security.txt" = {
|
|
||||||
alias = toString ./root/security.txt;
|
|
||||||
};
|
|
||||||
}))
|
|
||||||
|
|
||||||
(lib.genAttrs [
|
|
||||||
"pvv.ntnu.no"
|
|
||||||
"pvv.org"
|
"pvv.org"
|
||||||
"mail.pvv.ntnu.no"
|
|
||||||
"mail.pvv.org"
|
|
||||||
"smtp.pvv.ntnu.no"
|
|
||||||
"smtp.pvv.org"
|
|
||||||
] (_: {
|
|
||||||
locations."^~ /.well-known/autoconfig/mail/" = {
|
|
||||||
root = toString ./root/autoconfig/mail;
|
|
||||||
};
|
|
||||||
}))
|
|
||||||
|
|
||||||
(lib.genAttrs [
|
|
||||||
"pvv.ntnu.no"
|
|
||||||
"pvv.org"
|
|
||||||
"www.pvv.ntnu.no"
|
|
||||||
"www.pvv.org"
|
"www.pvv.org"
|
||||||
] (_: {
|
] (_: {
|
||||||
locations."^~ /.well-known/matrix/" = {
|
locations = {
|
||||||
|
"^~ /.well-known/" = {
|
||||||
|
alias = (toString ./root) + "/";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Proxy the matrix well-known files
|
||||||
|
# Host has be set before proxy_pass
|
||||||
|
# The header must be set so nginx on the other side routes it to the right place
|
||||||
|
"^~ /.well-known/matrix/" = {
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
proxy_set_header Host matrix.pvv.ntnu.no;
|
proxy_set_header Host matrix.pvv.ntnu.no;
|
||||||
proxy_pass https://matrix.pvv.ntnu.no/.well-known/matrix/;
|
proxy_pass https://matrix.pvv.ntnu.no/.well-known/matrix/;
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}))
|
};
|
||||||
];
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,6 +138,15 @@ in
|
|||||||
|
|
||||||
ExecStart =
|
ExecStart =
|
||||||
let
|
let
|
||||||
|
mkRespawningCommand = name: command: pkgs.writeShellScript "drumknotty-${name}-watchdog" ''
|
||||||
|
while true; do
|
||||||
|
${command}
|
||||||
|
echo
|
||||||
|
echo "${name} exited, restarting in 3s..." >&2
|
||||||
|
sleep 3
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
screenrc = let
|
screenrc = let
|
||||||
convertToFile = lines: lib.pipe lines [
|
convertToFile = lines: lib.pipe lines [
|
||||||
lib.concatLists
|
lib.concatLists
|
||||||
@@ -157,8 +166,7 @@ in
|
|||||||
config = "/etc/dibbler/dibbler.toml";
|
config = "/etc/dibbler/dibbler.toml";
|
||||||
};
|
};
|
||||||
in lib.optionals cfg.dibbler.enable [
|
in lib.optionals cfg.dibbler.enable [
|
||||||
"screen -t dibbler ${lib.getExe cfg.dibbler.package} ${dibblerArgs} loop"
|
"screen -t dibbler ${mkRespawningCommand "dibbler" "${lib.getExe cfg.dibbler.package} ${dibblerArgs} loop"}"
|
||||||
|
|
||||||
])
|
])
|
||||||
|
|
||||||
(let
|
(let
|
||||||
@@ -166,7 +174,7 @@ in
|
|||||||
config = "/etc/worblehat/config.toml";
|
config = "/etc/worblehat/config.toml";
|
||||||
};
|
};
|
||||||
in lib.optionals cfg.worblehat.enable [
|
in lib.optionals cfg.worblehat.enable [
|
||||||
"screen -t worblehat ${lib.getExe cfg.worblehat.package} ${worblehatArgs} cli"
|
"screen -t worblehat ${mkRespawningCommand "worblehat" "${lib.getExe cfg.worblehat.package} ${worblehatArgs} cli"}"
|
||||||
])
|
])
|
||||||
|
|
||||||
[ "select 0" ]
|
[ "select 0" ]
|
||||||
|
|||||||
Reference in New Issue
Block a user