From 55d5a8cb76ee9fa5eca73aea2d9d557388d29582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Sun, 11 Jan 2026 14:04:34 +0100 Subject: [PATCH 1/2] nixos/homebox: set HOME env var to fix startup issue Without this patch homebox logs this at startup: failed to create modcache index dir: mkdir /var/empty/.cache: read-only file system --- nixos/modules/services/web-apps/homebox.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nixos/modules/services/web-apps/homebox.nix b/nixos/modules/services/web-apps/homebox.nix index 2fdb1df7cfd1..e52ade290d06 100644 --- a/nixos/modules/services/web-apps/homebox.nix +++ b/nixos/modules/services/web-apps/homebox.nix @@ -43,6 +43,7 @@ in HBOX_OPTIONS_ALLOW_REGISTRATION = "false"; HBOX_OPTIONS_CHECK_GITHUB_RELEASE = "false"; HBOX_MODE = "production"; + HOME = "/var/lib/homebox"; } ''; description = '' @@ -92,6 +93,9 @@ in HBOX_OPTIONS_ALLOW_REGISTRATION = "false"; HBOX_OPTIONS_CHECK_GITHUB_RELEASE = "false"; HBOX_MODE = "production"; + # Fix this startup issue: + # failed to create modcache index dir: mkdir /var/empty/.cache: read-only file system + HOME = "/var/lib/homebox"; }) (mkIf cfg.database.createLocally { From db9da66ee4a7329af22ed77d2956f9254bc2b648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Sun, 11 Jan 2026 15:41:57 +0100 Subject: [PATCH 2/2] nixos/homebox: set TMPDIR to fix uploading attachments/images Or else we get this error: [...] rename /tmp/ced4804c80b1ed1f6e88060f6d829db421e6dbf3a189715265900b5d6b0243ed.1889b3d16ab36e22.tmp /var/lib/homebox/data/5f42f81b-e9ad-4495-b6a6-9e9f704db30e/documents/ced4804c80b1ed1f6e88060f6d829db421e6dbf3a189715265900b5d6b0243ed: invalid cross-device link" [...] (The alternative is to disable many systemd hardening directives...) --- nixos/modules/services/web-apps/homebox.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nixos/modules/services/web-apps/homebox.nix b/nixos/modules/services/web-apps/homebox.nix index e52ade290d06..570f2ee2a8ba 100644 --- a/nixos/modules/services/web-apps/homebox.nix +++ b/nixos/modules/services/web-apps/homebox.nix @@ -44,6 +44,7 @@ in HBOX_OPTIONS_CHECK_GITHUB_RELEASE = "false"; HBOX_MODE = "production"; HOME = "/var/lib/homebox"; + TMPDIR = "/var/lib/homebox/tmp"; } ''; description = '' @@ -96,6 +97,9 @@ in # Fix this startup issue: # failed to create modcache index dir: mkdir /var/empty/.cache: read-only file system HOME = "/var/lib/homebox"; + # Fix uploading/saving attachments/images: + # [...] rename /tmp/ced4804c80b1ed1f6e88060f6d829db421e6dbf3a189715265900b5d6b0243ed.1889b3d16ab36e22.tmp /var/lib/homebox/data/5f42f81b-e9ad-4495-b6a6-9e9f704db30e/documents/ced4804c80b1ed1f6e88060f6d829db421e6dbf3a189715265900b5d6b0243ed: invalid cross-device link" [...] + TMPDIR = "/var/lib/homebox/tmp"; }) (mkIf cfg.database.createLocally { @@ -121,6 +125,10 @@ in requires = lib.optional cfg.database.createLocally "postgresql.target"; after = lib.optional cfg.database.createLocally "postgresql.target"; environment = lib.filterAttrs (_: v: v != null) cfg.settings; + preStart = '' + "${pkgs.coreutils}/bin/rm" -rf /var/lib/homebox/tmp + "${pkgs.coreutils}/bin/mkdir" -p /var/lib/homebox/tmp + ''; serviceConfig = { User = cfg.user; Group = cfg.group;