feat: wiki test

This commit is contained in:
Nick 2024-10-19 15:04:13 -05:00
parent 825ed6fa5d
commit 608639fddb
9 changed files with 122 additions and 16 deletions

View file

@ -25,6 +25,7 @@
];
domain1SubdomainNames = [
"wiki"
"nextcloud"
"castopod"
"forgejo"

View file

@ -14,6 +14,7 @@
./owncast.nix
./samba.nix
./vaultwarden.nix
./wiki.nix
# These are all broken.

View file

@ -1,8 +1,8 @@
{flake, ...}: let
inherit (flake.config.people) user0;
inherit (flake.config.people.user.${user0}) domain;
inherit (flake.config.system.device) server wildcard;
inherit (flake.config.service.instance.owncast) paths ports subdomain ssl name;
inherit (flake.config.system.device) wildcard;
inherit (flake.config.service.instance.owncast) ports subdomain ssl;
localhost = wildcard.ip.address1;
host = "${subdomain}.${domain.url1}";
in {
@ -25,16 +25,6 @@ in {
};
};
};
# fileSystems."/var/lib/${name}" = {
# device = paths.path0;
# fsType = "none";
# options = ["bind"];
# depends = [server.storage0.mount];
# };
# systemd.tmpfiles.rules = [
# "Z ${paths.path0} 755 ${name} ${name} -"
# ];
networking = {
firewall = {

View file

@ -0,0 +1,77 @@
{
flake,
config,
...
}: let
inherit (flake.config.people) user0;
inherit (flake.config.people.user.${user0}) domain;
inherit (flake.config.system.device) server wildcard;
inherit (flake.config.service.instance.wiki) paths ports subdomain ssl sops name;
localhost = wildcard.ip.address1;
host = "${subdomain}.${domain.url1}";
in {
services = {
wiki-js = {
enable = true;
environmentFile = config.sops.secrets."wiki-pass".path;
settings = {
port = ports.port0;
bindIP = localhost;
db = {
type = "postgres";
};
};
};
caddy = {
virtualHosts = {
"${host}" = {
extraConfig = ''
reverse_proxy ${localhost}:${toString ports.port0}
tls ${ssl.cert} ${ssl.key}
'';
};
};
};
};
sops = let
sopsSecrets = ["pass"];
sopsPath = secret: {
path = "${sops.path0}/${name}-${secret}";
owner = name;
mode = "600";
};
in {
secrets = builtins.listToAttrs (
map
(secret: {
name = "${name}-${secret}";
value = sopsPath secret;
})
sopsSecrets
);
};
fileSystems."/var/lib/${name}" = {
device = paths.path0;
fsType = "none";
options = ["bind"];
depends = [server.storage0.mount];
};
systemd.tmpfiles.rules = [
"Z ${paths.path0} 755 ${name} ${name} -"
"Z ${sops.path0} 755 ${name} ${name} -"
];
networking = {
firewall = {
allowedTCPPorts = [
ports.port0
ports.port1
];
};
};
}