This commit is contained in:
2026-08-11 22:13:53 +03:00
parent 056e5895fe
commit 411c118500
29 changed files with 543 additions and 517 deletions
+23 -14
View File
@@ -42,21 +42,30 @@ in
# };
};
systemd.tmpfiles.rules = [
"d ${libraryDir} 0755 calibre-web calibre-web -"
"d ${sourceDir} 0755 calibre-web calibre-web -"
"Z ${libraryDir} 0755 calibre-web calibre-web -"
"Z ${sourceDir} 0755 calibre-web calibre-web -"
];
fileSystems = {
"${targetDir}" = {
device = "${sourceDir}";
fsType = "none";
options = [
"bind"
"nofail"
systemd.tmpfiles.rules =
xlib.helpers.mkTmpDirs {
dir = libraryDir;
mode = "0755";
user = "calibre-web";
group = "calibre-web";
types = [
"d"
"Z"
];
}
++ xlib.helpers.mkTmpDirs {
dir = sourceDir;
mode = "0755";
user = "calibre-web";
group = "calibre-web";
types = [
"d"
"Z"
];
};
fileSystems = xlib.helpers.mkBindMount {
what = sourceDir;
where = targetDir;
};
}
+2 -2
View File
@@ -44,7 +44,7 @@
# ./zerotier.nix
];
systemd.tmpfiles.rules = [
"d /mnt 0755 root root -"
"d ${xlib.dirs.services-mnt-folder} 0755 root root -"
(xlib.helpers.mkTmpfile "d" "/mnt" "0755" "root" "root")
(xlib.helpers.mkTmpfile "d" xlib.dirs.services-mnt-folder "0755" "root" "root")
];
}
+6 -4
View File
@@ -22,8 +22,10 @@
};
};
systemd.tmpfiles.rules = [
"d ${config.services.gitea.stateDir} 0755 gitea gitea -"
"z ${config.services.gitea.stateDir} 0755 gitea gitea -"
];
systemd.tmpfiles.rules = xlib.helpers.mkTmpDirs {
dir = config.services.gitea.stateDir;
mode = "0755";
user = "gitea";
group = "gitea";
};
}
+10 -23
View File
@@ -5,8 +5,11 @@
...
}:
let
sourceDir = "${xlib.dirs.services-mnt-folder}/homebox";
targetDir = "/var/lib/homebox";
storage = xlib.helpers.mkServiceStorage {
name = "homebox";
user = "homebox";
group = "homebox";
};
in
{
services.homebox = {
@@ -14,33 +17,17 @@ in
settings = {
HBOX_WEB_HOST = "0.0.0.0";
HBOX_WEB_PORT = "7745";
HBOX_STORAGE_CONN_STRING = "file://${targetDir}";
HBOX_STORAGE_CONN_STRING = "file://${storage.target}";
HBOX_STORAGE_PREFIX_PATH = "data";
HBOX_DATABASE_DRIVER = "sqlite3";
HBOX_DATABASE_SQLITE_PATH = "${targetDir}/data/homebox.db?_pragma=busy_timeout=999&_pragma=journal_mode=WAL&_fk=1";
HBOX_DATABASE_SQLITE_PATH = "${storage.target}/data/homebox.db?_pragma=busy_timeout=999&_pragma=journal_mode=WAL&_fk=1";
HBOX_OPTIONS_ALLOW_REGISTRATION = "true";
HBOX_OPTIONS_GITHUB_RELEASE_CHECK = "false";
HBOX_MODE = "production";
HOME = "${targetDir}";
TMPDIR = "${targetDir}/tmp";
HOME = "${storage.target}";
TMPDIR = "${storage.target}/tmp";
};
};
systemd = {
tmpfiles.rules = [
"d ${sourceDir} 0755 homebox homebox -"
"z ${sourceDir} 0755 homebox homebox -"
];
mounts = [
{
enable = true;
options = "bind,x-systemd.automount,nofail";
requires = [ "local-fs.target" ];
type = "none";
wantedBy = [ "multi-user.target" ];
what = "${sourceDir}";
where = "${targetDir}";
}
];
};
systemd = storage.systemd;
}
+1 -1
View File
@@ -20,7 +20,7 @@
};
systemd.tmpfiles.rules = [
"z ${config.services.immich.mediaLocation} 0755 immich immich -"
(xlib.helpers.mkTmpfile "z" config.services.immich.mediaLocation "0755" "immich" "immich")
];
users.users.immich.extraGroups = [
+1 -1
View File
@@ -21,6 +21,6 @@
};
systemd.tmpfiles.rules = [
"z /mnt/services/memos 0750 memos memos -"
(xlib.helpers.mkTmpfile "z" "${xlib.dirs.services-mnt-folder}/memos" "0750" "memos" "memos")
];
}
+6 -19
View File
@@ -7,8 +7,11 @@
...
}:
let
sourceDir = "${xlib.dirs.services-mnt-folder}/n8n";
targetDir = "/var/lib/n8n";
storage = xlib.helpers.mkServiceStorage {
name = "n8n";
user = "nobody";
group = "nogroup";
};
in
{
services.n8n = {
@@ -21,21 +24,5 @@ in
openFirewall = true;
};
systemd = {
tmpfiles.rules = [
"d ${sourceDir} 0755 nobody nogroup -"
"z ${sourceDir} 0755 nobody nogroup -"
];
mounts = [
{
enable = true;
options = "bind,x-systemd.automount,nofail";
requires = [ "local-fs.target" ];
type = "none";
wantedBy = [ "multi-user.target" ];
what = "${sourceDir}";
where = "${targetDir}";
}
];
};
systemd = storage.systemd;
}
+4 -9
View File
@@ -24,14 +24,9 @@ in
};
};
systemd.mounts = [
{
enable = true;
options = "bind,x-systemd.automount,nofail";
requires = [ "local-fs.target" ];
type = "none";
wantedBy = [ "multi-user.target" ];
what = "${libraryDir}";
where = "${pointDir}";
}
(xlib.helpers.mkSystemdBind {
what = libraryDir;
where = pointDir;
})
];
}
+1 -1
View File
@@ -201,7 +201,7 @@
# };
systemd.tmpfiles.rules = [
"z ${config.services.nextcloud.home} 0750 nextcloud nextcloud -"
(xlib.helpers.mkTmpfile "z" config.services.nextcloud.home "0750" "nextcloud" "nextcloud")
];
environment.systemPackages = [
+1 -1
View File
@@ -6,7 +6,7 @@
}:
{
systemd.tmpfiles.rules = [
"z /export 0755 nobody nogroup -"
(xlib.helpers.mkTmpfile "z" "/export" "0755" "nobody" "nogroup")
];
services.nfs = {
server = {
+78 -93
View File
@@ -7,6 +7,83 @@
}:
let
server = "192.168.1.20";
# Standard TLS proxy vhost: "/" -> http://server:port
# Returns { name = domain; value = vhost; } for builtins.listToAttrs
mkProxy =
{
domain,
port,
addSSL ? false,
body ? false,
}:
{
name = domain;
value = {
enableACME = true;
locations."/" = {
proxyPass = "http://${server}:${toString port}";
proxyWebsockets = true;
};
}
// lib.optionalAttrs (!addSSL) { forceSSL = true; }
// lib.optionalAttrs addSSL { addSSL = true; }
// lib.optionalAttrs body {
extraConfig = ''
client_max_body_size 5G;
'';
};
};
# Simple proxy sites
sites = [
{
domain = "immich.zeroq.su";
port = 2283;
addSSL = true;
body = true;
}
{
domain = "kuma.zeroq.su";
port = 4001;
}
{
domain = "health.zeroq.su";
port = 19999;
}
{
domain = "git.zeroq.su";
port = 3000;
}
{
domain = "homebox.zeroq.su";
port = 7745;
}
{
domain = "flux.zeroq.su";
port = 6061;
}
{
domain = "navidrome.zeroq.su";
port = 4533;
addSSL = true;
}
{
domain = "calibre.zeroq.su";
port = 8083;
body = true;
}
{
domain = "nix-cache.zeroq.su";
port = 5000;
body = true;
}
{
domain = "pdf.zeroq.su";
port = 8446;
body = true;
}
];
in
{
services = {
@@ -16,7 +93,7 @@ in
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
virtualHosts = {
virtualHosts = (builtins.listToAttrs (map mkProxy sites)) // {
"nextcloud.private" = {
forceSSL = false;
enableACME = false;
@@ -169,49 +246,6 @@ in
# client_max_body_size 5G;
# '';
# };
"immich.zeroq.su" = {
addSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://${server}:2283";
proxyWebsockets = true;
};
extraConfig = ''
client_max_body_size 5G;
'';
};
"kuma.zeroq.su" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://${server}:4001";
proxyWebsockets = true;
};
};
"health.zeroq.su" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://${server}:19999";
proxyWebsockets = true;
};
};
"git.zeroq.su" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://${server}:3000";
proxyWebsockets = true;
};
};
"homebox.zeroq.su" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://${server}:7745";
proxyWebsockets = true;
};
};
# "agent.zeroq.su" = {
# forceSSL = true;
# enableACME = true;
@@ -256,22 +290,6 @@ in
# };
};
};
"flux.zeroq.su" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://${server}:6061";
proxyWebsockets = true;
};
};
"navidrome.zeroq.su" = {
addSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://${server}:4533";
proxyWebsockets = true;
};
};
"vetymae.opencodes.zeroq.su" = {
forceSSL = true;
enableACME = true;
@@ -323,39 +341,6 @@ in
client_max_body_size 5G;
'';
};
"calibre.zeroq.su" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://${server}:8083";
proxyWebsockets = true;
};
extraConfig = ''
client_max_body_size 5G;
'';
};
"nix-cache.zeroq.su" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://${server}:5000";
proxyWebsockets = true;
};
extraConfig = ''
client_max_body_size 5G;
'';
};
"pdf.zeroq.su" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://${server}:8446";
proxyWebsockets = true;
};
extraConfig = ''
client_max_body_size 5G;
'';
};
# "calibre.home.arpa" = {
# forceSSL = true;
# enableACME = true;
+7 -19
View File
@@ -7,8 +7,12 @@
...
}:
let
sourceDir = "${xlib.dirs.services-mnt-folder}/postgresql";
targetDir = "/var/lib/postgresql";
storage = xlib.helpers.mkServiceStorage {
name = "postgresql";
user = "postgres";
group = "postgres";
mode = "0760";
};
in
{
services = {
@@ -19,21 +23,5 @@ in
# postgresqlBackup.enable = true;
};
systemd = {
tmpfiles.rules = [
"d ${sourceDir} 0760 postgres postgres -"
"z ${sourceDir} 0760 postgres postgres -"
];
mounts = [
{
enable = true;
options = "bind,x-systemd.automount,nofail";
requires = [ "local-fs.target" ];
type = "none";
wantedBy = [ "multi-user.target" ];
what = "${sourceDir}";
where = "${targetDir}";
}
];
};
systemd = storage.systemd;
}
+6 -19
View File
@@ -6,8 +6,11 @@
...
}:
let
sourceDir = "${xlib.dirs.services-mnt-folder}/samba";
targetDir = "/var/lib/samba";
storage = xlib.helpers.mkServiceStorage {
name = "samba";
user = "root";
group = "root";
};
in
{
services = {
@@ -69,21 +72,5 @@ in
};
};
systemd = {
tmpfiles.rules = [
"d ${sourceDir} 0755 root root -"
"z ${sourceDir} 0755 root root -"
];
mounts = [
{
enable = true;
options = "bind,x-systemd.automount,nofail";
requires = [ "local-fs.target" ];
type = "none";
wantedBy = [ "multi-user.target" ];
what = "${sourceDir}";
where = "${targetDir}";
}
];
};
systemd = storage.systemd;
}
+11 -12
View File
@@ -69,13 +69,9 @@ in
};
};
fileSystems."${targetDir}" = {
device = "${sourceDir}";
fsType = "none";
options = [
"bind"
"nofail"
];
fileSystems = xlib.helpers.mkBindMount {
what = sourceDir;
where = targetDir;
};
environment = {
@@ -84,11 +80,14 @@ in
];
};
systemd.tmpfiles.rules = [
"d ${sourceDir} 0755 nobody nogroup -"
"z ${sourceDir} 0755 nobody nogroup -"
"Z ${sourceDir}/ 0700 nobody nogroup -"
];
systemd.tmpfiles.rules =
xlib.helpers.mkTmpDirs {
dir = sourceDir;
mode = "0755";
user = "nobody";
group = "nogroup";
}
++ [ (xlib.helpers.mkTmpfile "Z" "${sourceDir}/" "0700" "nobody" "nogroup") ];
sops.secrets = {
intermediate-password = {
+1 -1
View File
@@ -18,6 +18,6 @@ in
};
systemd.tmpfiles.rules = [
"z ${sourceDir} 0750 trilium trilium -"
(xlib.helpers.mkTmpfile "z" sourceDir "0750" "trilium" "trilium")
];
}
+4 -8
View File
@@ -20,15 +20,11 @@ in
};
systemd.tmpfiles.rules = [
"z ${xlib.dirs.services-mnt-folder}/uptime-kuma 0755 nobody nogroup -"
(xlib.helpers.mkTmpfile "z" sourceDir "0755" "nobody" "nogroup")
];
fileSystems."${targetDir}" = {
device = "${xlib.dirs.services-mnt-folder}/uptime-kuma";
fsType = "none";
options = [
"bind"
"nofail"
];
fileSystems = xlib.helpers.mkBindMount {
what = sourceDir;
where = targetDir;
};
}