treefmt + samba dir changed
This commit is contained in:
1 parent
d1b1b07903
commit
d6d64d21c3
29 files changed
+998
-1122
No files matched your search
@@ -1,4 +1,9 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.modules."3x-ui";
|
||||
in
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
#qogir-kde
|
||||
#qogir-theme
|
||||
qogir-icon-theme
|
||||
whitesur-cursors # WhiteSur look-and-feel sets this cursor; without it
|
||||
# kwin logs `Failed to load cursor theme "WhiteSur-cursors"`
|
||||
whitesur-cursors
|
||||
# WhiteSur look-and-feel sets this cursor; without it
|
||||
# kwin logs `Failed to load cursor theme "WhiteSur-cursors"`
|
||||
whitesur-gtk-theme
|
||||
whitesur-icon-theme
|
||||
whitesur-kde
|
||||
|
||||
@@ -282,7 +282,10 @@
|
||||
'';
|
||||
};
|
||||
bootMode = lib.mkOption {
|
||||
type = lib.types.enum [ "direct" "pxe" ];
|
||||
type = lib.types.enum [
|
||||
"direct"
|
||||
"pxe"
|
||||
];
|
||||
default = "direct";
|
||||
description = ''
|
||||
How the guest obtains its boot image.
|
||||
|
||||
@@ -91,8 +91,7 @@
|
||||
# В otreca аналогичный юнит определён в `modules/vds/default.nix` с
|
||||
# другим `PANEL_URL`/`apiToken`.
|
||||
systemd.services."3xui-reconfig" = {
|
||||
description =
|
||||
"Перегенерировать config.json 3x-ui из БД и рестартнуть xray (R1.18).";
|
||||
description = "Перегенерировать config.json 3x-ui из БД и рестартнуть xray (R1.18).";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = lib.getExe config.modules."3x-ui".reconfig;
|
||||
|
||||
@@ -208,11 +208,14 @@ in
|
||||
documentation = [ "https://github.com/oqyude/engipy" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
after = [ "network-online.target" "engipy-install.service" ];
|
||||
after = [
|
||||
"network-online.target"
|
||||
"engipy-install.service"
|
||||
];
|
||||
wants = [ "network-online.target" ];
|
||||
requires = [ "engipy-install.service" ];
|
||||
|
||||
environment = {
|
||||
environment = {
|
||||
PYTHONUNBUFFERED = "1";
|
||||
PYTHONDONTWRITEBYTECODE = "1";
|
||||
VIRTUAL_ENV = "${cfg.dataDir}/venv";
|
||||
@@ -261,7 +264,8 @@ environment = {
|
||||
User = cfg.user;
|
||||
Group = cfg.user;
|
||||
WorkingDirectory = cfg.dataDir;
|
||||
ExecStart = "${cfg.dataDir}/venv/bin/uvicorn --factory app.main:create_app"
|
||||
ExecStart =
|
||||
"${cfg.dataDir}/venv/bin/uvicorn --factory app.main:create_app"
|
||||
+ " --host ${cfg.bindAddress} --port ${toString cfg.port} --no-access-log";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "5s";
|
||||
@@ -279,7 +283,11 @@ environment = {
|
||||
RestrictRealtime = true;
|
||||
LockPersonality = true;
|
||||
ProtectControlGroups = true;
|
||||
RestrictAddressFamilies = [ "AF_INET" "AF_INET6" "AF_UNIX" ];
|
||||
RestrictAddressFamilies = [
|
||||
"AF_INET"
|
||||
"AF_INET6"
|
||||
"AF_UNIX"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -18,9 +18,9 @@ in
|
||||
# ----- Static user for the runner ----------------------------------------
|
||||
users.users.gitea-runner = {
|
||||
isSystemUser = true;
|
||||
group = "gitea-runner";
|
||||
home = "/var/lib/gitea-runner";
|
||||
description = "Gitea Actions Runner (sapphira host executor)";
|
||||
group = "gitea-runner";
|
||||
home = "/var/lib/gitea-runner";
|
||||
description = "Gitea Actions Runner (sapphira host executor)";
|
||||
};
|
||||
users.groups.gitea-runner = { };
|
||||
|
||||
@@ -39,21 +39,21 @@ in
|
||||
# decoded to a YAML body that EnvironmentFile could not parse, so
|
||||
# the runner received no $TOKEN at all and Gitea replied
|
||||
# "runner registration token not found".
|
||||
path = "/var/lib/gitea-runner/registration-token";
|
||||
format = "dotenv";
|
||||
path = "/var/lib/gitea-runner/registration-token";
|
||||
format = "dotenv";
|
||||
sopsFile = ../../secrets/gitea-runner-registration.env;
|
||||
owner = "gitea-runner";
|
||||
group = "gitea-runner";
|
||||
mode = "0440";
|
||||
owner = "gitea-runner";
|
||||
group = "gitea-runner";
|
||||
mode = "0440";
|
||||
};
|
||||
|
||||
# ----- The runner itself -------------------------------------------------
|
||||
services.gitea-actions-runner.instances."${name}" = {
|
||||
enable = true;
|
||||
name = name;
|
||||
url = "https://git.zeroq.su/"; # matches modules/server/gitea.nix ROOT_URL
|
||||
enable = true;
|
||||
name = name;
|
||||
url = "https://git.zeroq.su/"; # matches modules/server/gitea.nix ROOT_URL
|
||||
tokenFile = config.sops.secrets.gitea-runner-registration.path;
|
||||
labels = [ "native:host" ]; # only host-executor; no docker required
|
||||
labels = [ "native:host" ]; # only host-executor; no docker required
|
||||
|
||||
settings = {
|
||||
runner = {
|
||||
@@ -112,9 +112,9 @@ in
|
||||
# tmpfiles setup. We still add a tmpfiles rule for /tmp/gitea-runner-work
|
||||
# so successive deployments don't briefly see an empty target.
|
||||
systemd.tmpfiles.rules = xlib.helpers.mkTmpDirs {
|
||||
dir = "/tmp/gitea-runner-work";
|
||||
mode = "1777"; # sticky so different runner invocations don't clobber
|
||||
user = "root";
|
||||
dir = "/tmp/gitea-runner-work";
|
||||
mode = "1777"; # sticky so different runner invocations don't clobber
|
||||
user = "root";
|
||||
group = "root";
|
||||
};
|
||||
|
||||
|
||||
@@ -374,7 +374,7 @@ in
|
||||
# patch that reads X-Forwarded-Host (fork + plugin link) — the
|
||||
# same-origin check assumes direct loopback or Tailscale serve,
|
||||
# both of which give request.url a host that matches the browser.
|
||||
"herdr.zeroq.su" = {
|
||||
"herdr.zeroq.su" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations = {
|
||||
|
||||
+32
-17
@@ -137,8 +137,20 @@ let
|
||||
# realm = AD.ZEROQ.SU (realm Kerberos, верхний регистр)
|
||||
# dnsDomain = ad.zeroq.su (AD DNS-зона, нижний регистр)
|
||||
# Можно задать любой один, второй выводится.
|
||||
realm = if cfg.realm != null then lib.strings.toUpper cfg.realm else if cfg.dnsDomain != null then lib.strings.toUpper cfg.dnsDomain else null;
|
||||
dnsDomain = if cfg.dnsDomain != null then lib.strings.toLower cfg.dnsDomain else if cfg.realm != null then lib.strings.toLower cfg.realm else null;
|
||||
realm =
|
||||
if cfg.realm != null then
|
||||
lib.strings.toUpper cfg.realm
|
||||
else if cfg.dnsDomain != null then
|
||||
lib.strings.toUpper cfg.dnsDomain
|
||||
else
|
||||
null;
|
||||
dnsDomain =
|
||||
if cfg.dnsDomain != null then
|
||||
lib.strings.toLower cfg.dnsDomain
|
||||
else if cfg.realm != null then
|
||||
lib.strings.toLower cfg.realm
|
||||
else
|
||||
null;
|
||||
|
||||
# Заглушки на случай, когда не задано ни то, ни другое (закрыто assertion'ом).
|
||||
realmValue = if realm != null then realm else "<unset>";
|
||||
@@ -162,16 +174,22 @@ let
|
||||
cache directory = ${stateDir}/cache
|
||||
binddns dir = ${stateDir}/bind-dns
|
||||
idmap_ldb:use rfc2307 = yes
|
||||
${lib.optionalString (cfg.dnsBackend == "SAMBA_INTERNAL") ''
|
||||
dns port = ${toString cfg.dnsPort}
|
||||
''}${lib.optionalString (cfg.dnsForwarder != null) ''
|
||||
dns forwarder = ${cfg.dnsForwarder}
|
||||
''}${lib.optionalString (cfg.dnsBackend == "NONE") ''
|
||||
# dnsBackend = NONE: DC не поднимает DNS-сервер вовсе, порт 53 он
|
||||
# не трогает. Тогда AD-зоны должны обслуживать кто-то другой —
|
||||
# см. note-файл.
|
||||
server services = -dns
|
||||
''}
|
||||
${
|
||||
lib.optionalString (cfg.dnsBackend == "SAMBA_INTERNAL") ''
|
||||
dns port = ${toString cfg.dnsPort}
|
||||
''
|
||||
}${
|
||||
lib.optionalString (cfg.dnsForwarder != null) ''
|
||||
dns forwarder = ${cfg.dnsForwarder}
|
||||
''
|
||||
}${
|
||||
lib.optionalString (cfg.dnsBackend == "NONE") ''
|
||||
# dnsBackend = NONE: DC не поднимает DNS-сервер вовсе, порт 53 он
|
||||
# не трогает. Тогда AD-зоны должны обслуживать кто-то другой —
|
||||
# см. note-файл.
|
||||
server services = -dns
|
||||
''
|
||||
}
|
||||
[sysvol]
|
||||
path = ${sysvolPath}
|
||||
read only = no
|
||||
@@ -430,9 +448,7 @@ in
|
||||
}
|
||||
{
|
||||
assertion =
|
||||
cfg.dnsBackend != "SAMBA_INTERNAL"
|
||||
|| cfg.dnsPort != 53
|
||||
|| !config.services.coredns.enable;
|
||||
cfg.dnsBackend != "SAMBA_INTERNAL" || cfg.dnsPort != 53 || !config.services.coredns.enable;
|
||||
message = ''
|
||||
host.samba-ad: КОНФЛИКТ ПОРТА 53. Встроенный DNS AD DC
|
||||
(dnsBackend = "SAMBA_INTERNAL", dnsPort = 53) и coredns оба хотят
|
||||
@@ -451,8 +467,7 @@ in
|
||||
'';
|
||||
}
|
||||
{
|
||||
assertion =
|
||||
!(config.services.samba.enable && config.services.samba.smbd.enable);
|
||||
assertion = !(config.services.samba.enable && config.services.samba.smbd.enable);
|
||||
message = ''
|
||||
host.samba-ad: КОНФЛИКТ ПОРТА 445. AD DC обязан отдавать sysvol по
|
||||
SMB (без этого не работает групповая политика), поэтому DC занимает
|
||||
|
||||
@@ -58,7 +58,7 @@ in
|
||||
"force group" = "root";
|
||||
};
|
||||
"${xlib.device.username}" = {
|
||||
"path" = "${xlib.dirs.server-home}";
|
||||
"path" = "${xlib.dirs.user-home}";
|
||||
"browseable" = "yes";
|
||||
"read only" = "no";
|
||||
"valid users" = "${xlib.device.username}";
|
||||
|
||||
+29
-29
@@ -41,39 +41,39 @@ in
|
||||
# Generate the host key on first activation (idempotent).
|
||||
build.activation = {
|
||||
sshd = ''
|
||||
if [[ ! -d "${sshdDir}" ]]; then
|
||||
$DRY_RUN_CMD rm -rf "${sshdTmpDir}"
|
||||
$DRY_RUN_CMD mkdir -p "${sshdTmpDir}"
|
||||
$VERBOSE_ECHO "Generating sshd host key..."
|
||||
$DRY_RUN_CMD ${pkgs.openssh}/bin/ssh-keygen -t ed25519 -f "${sshdTmpDir}/ssh_host_ed25519_key" -N ""
|
||||
$DRY_RUN_CMD mv "${sshdTmpDir}" "${sshdDir}"
|
||||
fi
|
||||
'';
|
||||
if [[ ! -d "${sshdDir}" ]]; then
|
||||
$DRY_RUN_CMD rm -rf "${sshdTmpDir}"
|
||||
$DRY_RUN_CMD mkdir -p "${sshdTmpDir}"
|
||||
$VERBOSE_ECHO "Generating sshd host key..."
|
||||
$DRY_RUN_CMD ${pkgs.openssh}/bin/ssh-keygen -t ed25519 -f "${sshdTmpDir}/ssh_host_ed25519_key" -N ""
|
||||
$DRY_RUN_CMD mv "${sshdTmpDir}" "${sshdDir}"
|
||||
fi
|
||||
'';
|
||||
|
||||
# nix-on-droid's session-init adds ~/.nix-defexpr/channels to NIX_PATH
|
||||
# unconditionally; nix warns about the missing dir on every invocation.
|
||||
# Making it exist silences the warning. Must be done in activation (not
|
||||
# home-manager): ~/.nix-defexpr/channels is a symlink into
|
||||
# ~/.local/state/nix/profiles/channels (dangling until it exists), which
|
||||
# home-manager cannot link into. mkdir -p refuses to traverse a dangling
|
||||
# symlink, so create the real target dir instead.
|
||||
# nix-on-droid's session-init adds ~/.nix-defexpr/channels to NIX_PATH
|
||||
# unconditionally; nix warns about the missing dir on every invocation.
|
||||
# Making it exist silences the warning. Must be done in activation (not
|
||||
# home-manager): ~/.nix-defexpr/channels is a symlink into
|
||||
# ~/.local/state/nix/profiles/channels (dangling until it exists), which
|
||||
# home-manager cannot link into. mkdir -p refuses to traverse a dangling
|
||||
# symlink, so create the real target dir instead.
|
||||
nixdefexpr = ''
|
||||
$DRY_RUN_CMD mkdir -p "${config.user.home}/.local/state/nix/profiles/channels/nixpkgs"
|
||||
$DRY_RUN_CMD touch "${config.user.home}/.local/state/nix/profiles/channels/nixpkgs/.keep"
|
||||
'';
|
||||
$DRY_RUN_CMD mkdir -p "${config.user.home}/.local/state/nix/profiles/channels/nixpkgs"
|
||||
$DRY_RUN_CMD touch "${config.user.home}/.local/state/nix/profiles/channels/nixpkgs/.keep"
|
||||
'';
|
||||
|
||||
# runit service tree: ~/service/<name>/{run,log/run}. run/ and log/run are
|
||||
# symlinks into the nix store (read-only is fine; runsvdir writes only to
|
||||
# the <name>/supervise dirs). /etc/service is symlinked for `sv status`.
|
||||
# NOTE: tailscaled was removed — nixpkgs' linux build cannot run inside
|
||||
# proot (SELinux blocks netlink; needs GOOS=android or root). Re-add only
|
||||
# if that gets solved.
|
||||
# runit service tree: ~/service/<name>/{run,log/run}. run/ and log/run are
|
||||
# symlinks into the nix store (read-only is fine; runsvdir writes only to
|
||||
# the <name>/supervise dirs). /etc/service is symlinked for `sv status`.
|
||||
# NOTE: tailscaled was removed — nixpkgs' linux build cannot run inside
|
||||
# proot (SELinux blocks netlink; needs GOOS=android or root). Re-add only
|
||||
# if that gets solved.
|
||||
services = ''
|
||||
$DRY_RUN_CMD rm -rf ${serviceDir}/tailscaled
|
||||
$DRY_RUN_CMD mkdir -p ${serviceDir}/sshd/log
|
||||
$DRY_RUN_CMD ln -sfn ${sshdRun}/bin/sshd-run ${serviceDir}/sshd/run
|
||||
$DRY_RUN_CMD ln -sfn ${svLogRun}/bin/sv-log-run ${serviceDir}/sshd/log/run
|
||||
$DRY_RUN_CMD ln -sfn ${serviceDir} /etc/service
|
||||
$DRY_RUN_CMD rm -rf ${serviceDir}/tailscaled
|
||||
$DRY_RUN_CMD mkdir -p ${serviceDir}/sshd/log
|
||||
$DRY_RUN_CMD ln -sfn ${sshdRun}/bin/sshd-run ${serviceDir}/sshd/run
|
||||
$DRY_RUN_CMD ln -sfn ${svLogRun}/bin/sv-log-run ${serviceDir}/sshd/log/run
|
||||
$DRY_RUN_CMD ln -sfn ${serviceDir} /etc/service
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
@@ -38,8 +38,7 @@
|
||||
# их по очереди; один из них адресует локальную панель, другой — удалённую,
|
||||
# и оба лечат одно и то же «сервер крутит старое».)
|
||||
systemd.services."3xui-reconfig" = {
|
||||
description =
|
||||
"Перегенерировать config.json 3x-ui из БД и рестартнуть xray (R1.18) — вариант для Otreca (публичный домен).";
|
||||
description = "Перегенерировать config.json 3x-ui из БД и рестартнуть xray (R1.18) — вариант для Otreca (публичный домен).";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = lib.getExe config.modules."3x-ui".reconfig;
|
||||
|
||||
Reference in new issue
Block a user