Files
oqyude ae760f6ab4
nixos flake checks / invariant-checks (push) Successful in 1m44s
test-runner / smoke (push) Successful in 1s
домены: реестр xlib.net.domains + синхронизация webDomain 3x-ui (T63, ADR-0012)
- lib/xlib/net.nix: domains.public/opencodes/internal/ad; все живые
  хостнеймы выводятся из реестра (nginx, coredns, authelia, nextcloud,
  gitea, vds, netbird, open-webui, opencode, nix-cache). Литералы — только
  в комментариях/example/email/trusted-key и в БД панели.
- 3xui-domain-sync.service: before+wantedBy podman-3xui_app, идемпотентно
  приводит settings.webDomain к host."3x-ui".certDomain ДО старта панели
  (R1.19/инвариант 19); контейнер сам не перезапускает.
- config-fingerprint до/после: значения не изменились — 0 отличий на
  rydiwo/atoridu/wsl, на sapphira/otreca только новый юнит и unitConfig.
- epral: убран nginx-mainline из strictModule (nix-on-droid не вычислялся
  с 5712abb); в AGENTS.md исправлен вывод (build.activationPackage) и
  добавлен --impure — T64 (проверить сборку на устройстве).
- .agent: закрыты T10/T49/T50/T54, добавлены T63 (done) и T64 (pending),
  ADR-0012; phases в manifest.json синхронизированы с checkpoints.json.
2026-11-26 20:16:09 +03:00

296 lines
8.3 KiB
Nix

{
config,
inputs,
lib,
pkgs,
xlib,
...
}:
let
master = import inputs.nixpkgs-master {
system = "x86_64-linux";
config.allowUnfree = true;
config.allowUnfreePredicate = true;
};
fqdn = name: "${name}.${xlib.net.domains.public}";
lan = name: "${name}.${xlib.net.domains.internal}";
in
{
services = {
nextcloud-whiteboard-server = {
enable = true;
settings = {
NEXTCLOUD_URL = "https://${fqdn "nextcloud"}";
};
secrets = [ config.sops.secrets.nextcloud-whiteboard-jwt.path ];
};
nextcloud-spreed-signaling = {
enable = false;
hostName = "talk.private";
backends.nextcloud = {
urls = [
"https://${fqdn "nextcloud"}"
# "https://nextcloud.home.arpa"
];
secretFile = config.sops.secrets.nextcloud-talk-secret.path;
};
settings = {
http.listen = "127.0.0.1:8080";
clients.internalsecretFile = config.sops.secrets.internal-secret.path;
sessions = {
hashkeyFile = config.sops.secrets.hashkey.path;
blockkeyFile = config.sops.secrets.blockkey.path;
};
mcu = {
type = "janus";
url = "ws://127.0.0.1:8188";
};
turn = {
secretFile = config.sops.secrets.turn-secret.path;
apikeyFile = config.sops.secrets.turn-api-key.path;
servers = [
"turn:${fqdn "turn"}:3478?transport=udp"
"turn:${fqdn "turn"}:3478?transport=tcp"
# "turns:turn.zeroq.su:5349?transport=tcp"
];
};
};
};
nextcloud = {
enable = true;
package = pkgs.nextcloud35;
hostName = "nextcloud.private";
database.createLocally = true;
home = "${xlib.dirs.services-mnt-folder}/nextcloud";
configureRedis = true;
https = true;
caching = {
redis = true;
memcached = true;
};
maxUploadSize = "5G";
config = {
dbtype = "pgsql";
dbuser = "nextcloud";
dbname = "nextcloud";
# adminuser/adminpassFile удалены из nixpkgs (mkRemovedOptionModule):
# начального админа теперь создают вручную — `nextcloud-occ user:add`.
# На существующей установке админ уже есть, эти строки ничего не делали.
};
settings = {
log_type = "file";
trusted_domains = [
xlib.net.hosts.sapphira.tailscale
xlib.net.hosts.sapphira.lan
xlib.net.hosts.router.public
"localhost"
(lan "nextcloud")
"nextcloud.private"
(fqdn "nextcloud")
(lan "office")
(fqdn "office")
];
trusted_proxies = [
xlib.net.hosts.otreca.tailscale
xlib.net.hosts.otreca.public
xlib.net.hosts.sapphira.lan
xlib.net.hosts.router.public
];
overwriteprotocol = "https"; # maybe no
};
extraAppsEnable = true;
appstoreEnable = false;
notify_push = {
enable = true;
bendDomainToLocalhost = true;
nextcloudUrl = "https://${fqdn "nextcloud"}";
};
# phpPackage = pkgs.php85;
extraApps = {
inherit (config.services.nextcloud.package.packages.apps)
# richdocuments
# gpoddersync
# integration_paperless
# memories
# news
# nextpod
# notify_push
# phonetrack
# repod
# sociallogin
bookmarks
calendar
collectives
contacts
cookbook
cospend
dav_push
deck
files_retention
forms
groupfolders
impersonate
mail
music
notes
onlyoffice
polls
# previewgenerator
spreed
tables
tasks
user_oidc
user_saml
whiteboard
;
# inherit (pkgs.nextcloud31Packages.apps)
# # end_to_end_encryption
# # maps
# tasks
# ;
};
};
# collabora-online = {
# enable = false;
# port = 9980;
# # package = master.collabora-online;
# settings = {
# server_name = "office.zeroq.su";
# ssl = {
# enable = false;
# termination = true;
# ssl_verification = false;
# };
# net = {
# listen = "0.0.0.0";
# post_allow.host = [
# "0.0.0.0"
# ];
# };
# storage.wopi = {
# "@allow" = true;
# host = [
# "0.0.0.0/0"
# ];
# };
# };
# };
};
# fonts.packages = [ work.corefonts ];
# networking.hosts = {
# "localhost" = [ "nextcloud-private.local" ];
# };
# systemd.services.nextcloud-config-collabora =
# let
# inherit (config.services.nextcloud) occ;
# wopi_url = "http://localhost:${toString config.services.collabora-online.port}";
# public_wopi_url = "https://office.zeroq.su";
# wopi_allowlist = lib.concatStringsSep "," [
# "0.0.0.0/0"
# ];
# in
# {
# wantedBy = [ "multi-user.target" ];
# after = [
# "nextcloud-setup.service"
# "coolwsd.service"
# ];
# requires = [ "coolwsd.service" ];
# script = ''
# ${occ}/bin/nextcloud-occ config:app:set richdocuments wopi_url --value ${lib.escapeShellArg wopi_url}
# ${occ}/bin/nextcloud-occ config:app:set richdocuments public_wopi_url --value ${lib.escapeShellArg public_wopi_url}
# ${occ}/bin/nextcloud-occ config:app:set richdocuments wopi_allowlist --value ${lib.escapeShellArg wopi_allowlist}
# ${occ}/bin/nextcloud-occ richdocuments:setup
# '';
# serviceConfig = {
# Type = "oneshot";
# };
# };
systemd = {
tmpfiles.rules = [
(xlib.helpers.mkTmpfile "z" config.services.nextcloud.home "0750" "nextcloud" "nextcloud")
];
# nixpkgs serves nextcloud through the PHP-FPM unit `phpfpm-nextcloud`;
# there is NO unit called `nextcloud`. `systemd.services.nextcloud` would
# render a phantom unit with no ExecStart → systemd refuses to start it
# (ADR-0004).
#
# `unitConfig` → `[Unit]`: `ConditionPathIsMountPoint` is a unit-level
# directive and is ignored by systemd in `[Service]` (T4/R1.2).
services."phpfpm-nextcloud".unitConfig = xlib.helpers.mkStorageGuard xlib;
};
environment.systemPackages = [
pkgs.nc4nix # Packaging helper for Nextcloud apps
];
sops.secrets = {
nextcloud-adminpass = {
format = "yaml";
key = "adminpass";
sopsFile = ./secrets/nextcloud.yaml;
owner = "nextcloud";
group = "nextcloud";
mode = "0650";
};
nextcloud-whiteboard-jwt = {
format = "yaml";
key = "whiteboard-jwt";
sopsFile = ./secrets/nextcloud.yaml;
owner = "nextcloud";
group = "nextcloud";
mode = "0650";
};
nextcloud-talk-secret = {
format = "yaml";
key = "nextcloud-talk-secret";
sopsFile = ./secrets/nextcloud.yaml;
# owner = "nextcloud-spreed-signaling";
# group = "nextcloud-spreed-signaling";
mode = "0440";
};
internal-secret = {
format = "yaml";
key = "internal-secret";
sopsFile = ./secrets/nextcloud.yaml;
# owner = "nextcloud-spreed-signaling";
# group = "nextcloud-spreed-signaling";
mode = "0440";
};
hashkey = {
format = "yaml";
key = "hashkey";
sopsFile = ./secrets/nextcloud.yaml;
# owner = "nextcloud-spreed-signaling";
# group = "nextcloud-spreed-signaling";
mode = "0440";
};
blockkey = {
format = "yaml";
key = "blockkey";
sopsFile = ./secrets/nextcloud.yaml;
# owner = "nextcloud-spreed-signaling";
# group = "nextcloud-spreed-signaling";
mode = "0440";
};
turn-secret = {
format = "yaml";
key = "turn-secret";
sopsFile = ./secrets/coturn.yaml;
# group = "nextcloud-spreed-signaling";
mode = "0440";
};
turn-api-key = {
format = "yaml";
key = "turn-api-key";
sopsFile = ./secrets/coturn.yaml;
# group = "nextcloud-spreed-signaling";
mode = "0440";
};
};
}