Loading nixos/modules/services/misc/homepage-dashboard.nix +2 −0 Original line number Diff line number Diff line Loading @@ -222,6 +222,7 @@ in environment = { HOMEPAGE_CONFIG_DIR = configDir; HOMEPAGE_CACHE_DIR = "/var/cache/homepage-dashboard"; PORT = toString cfg.listenPort; LOG_TARGETS = lib.mkIf managedConfig "stdout"; }; Loading @@ -231,6 +232,7 @@ in DynamicUser = true; EnvironmentFile = lib.mkIf (cfg.environmentFile != null) cfg.environmentFile; StateDirectory = lib.mkIf (!managedConfig) "homepage-dashboard"; CacheDirectory = "homepage-dashboard"; ExecStart = lib.getExe cfg.package; Restart = "on-failure"; }; Loading pkgs/servers/homepage-dashboard/default.nix +15 −2 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ nixosTests, enableLocalIcons ? false, nix-update-script, git, }: let dashboardIcons = fetchFromGitHub { Loading Loading @@ -49,7 +50,7 @@ buildNpmPackage rec { patchShebangs .next/standalone/server.js ''; nativeBuildInputs = lib.optionals stdenv.isDarwin [ cctools ]; nativeBuildInputs = [ git ] ++ lib.optionals stdenv.isDarwin [ cctools ]; buildInputs = [ nodePackages.node-gyp-build ] ++ lib.optionals stdenv.isDarwin [ IOKit ]; Loading @@ -68,9 +69,21 @@ buildNpmPackage rec { chmod +x $out/share/homepage/server.js # This patch must be applied here, as it's patching the `dist` directory # of NextJS. Without this, homepage-dashboard errors when trying to # write its prerender cache. # # This patch ensures that the cache implementation respects the env # variable `HOMEPAGE_CACHE_DIR`, which is set by default in the # wrapper below. pushd $out git apply ${./prerender_cache_path.patch} popd makeWrapper $out/share/homepage/server.js $out/bin/homepage \ --set-default PORT 3000 \ --set-default HOMEPAGE_CONFIG_DIR /var/lib/homepage-dashboard --set-default HOMEPAGE_CONFIG_DIR /var/lib/homepage-dashboard \ --set-default HOMEPAGE_CACHE_DIR /var/cache/homepage-dashboard ${if enableLocalIcons then installLocalIcons else ""} Loading pkgs/servers/homepage-dashboard/prerender_cache_path.patch 0 → 100644 +18 −0 Original line number Diff line number Diff line diff --git a/share/homepage/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js b/share/homepage/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js index b1b74d8..a46c80b 100644 --- a/share/homepage/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js +++ b/share/homepage/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js @@ -5,11 +5,12 @@ Object.defineProperty(exports, "__esModule", { exports.default = void 0; var _lruCache = _interopRequireDefault(require("next/dist/compiled/lru-cache")); var _path = _interopRequireDefault(require("../../../shared/lib/isomorphic/path")); +var path = require('node:path'); class FileSystemCache { constructor(ctx){ this.fs = ctx.fs; this.flushToDisk = ctx.flushToDisk; - this.serverDistDir = ctx.serverDistDir; + this.serverDistDir = path.join(process.env.HOMEPAGE_CACHE_DIR, "homepage"); this.appDir = !!ctx._appDir; if (ctx.maxMemoryCacheSize) { this.memoryCache = new _lruCache.default({ Loading
nixos/modules/services/misc/homepage-dashboard.nix +2 −0 Original line number Diff line number Diff line Loading @@ -222,6 +222,7 @@ in environment = { HOMEPAGE_CONFIG_DIR = configDir; HOMEPAGE_CACHE_DIR = "/var/cache/homepage-dashboard"; PORT = toString cfg.listenPort; LOG_TARGETS = lib.mkIf managedConfig "stdout"; }; Loading @@ -231,6 +232,7 @@ in DynamicUser = true; EnvironmentFile = lib.mkIf (cfg.environmentFile != null) cfg.environmentFile; StateDirectory = lib.mkIf (!managedConfig) "homepage-dashboard"; CacheDirectory = "homepage-dashboard"; ExecStart = lib.getExe cfg.package; Restart = "on-failure"; }; Loading
pkgs/servers/homepage-dashboard/default.nix +15 −2 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ nixosTests, enableLocalIcons ? false, nix-update-script, git, }: let dashboardIcons = fetchFromGitHub { Loading Loading @@ -49,7 +50,7 @@ buildNpmPackage rec { patchShebangs .next/standalone/server.js ''; nativeBuildInputs = lib.optionals stdenv.isDarwin [ cctools ]; nativeBuildInputs = [ git ] ++ lib.optionals stdenv.isDarwin [ cctools ]; buildInputs = [ nodePackages.node-gyp-build ] ++ lib.optionals stdenv.isDarwin [ IOKit ]; Loading @@ -68,9 +69,21 @@ buildNpmPackage rec { chmod +x $out/share/homepage/server.js # This patch must be applied here, as it's patching the `dist` directory # of NextJS. Without this, homepage-dashboard errors when trying to # write its prerender cache. # # This patch ensures that the cache implementation respects the env # variable `HOMEPAGE_CACHE_DIR`, which is set by default in the # wrapper below. pushd $out git apply ${./prerender_cache_path.patch} popd makeWrapper $out/share/homepage/server.js $out/bin/homepage \ --set-default PORT 3000 \ --set-default HOMEPAGE_CONFIG_DIR /var/lib/homepage-dashboard --set-default HOMEPAGE_CONFIG_DIR /var/lib/homepage-dashboard \ --set-default HOMEPAGE_CACHE_DIR /var/cache/homepage-dashboard ${if enableLocalIcons then installLocalIcons else ""} Loading
pkgs/servers/homepage-dashboard/prerender_cache_path.patch 0 → 100644 +18 −0 Original line number Diff line number Diff line diff --git a/share/homepage/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js b/share/homepage/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js index b1b74d8..a46c80b 100644 --- a/share/homepage/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js +++ b/share/homepage/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js @@ -5,11 +5,12 @@ Object.defineProperty(exports, "__esModule", { exports.default = void 0; var _lruCache = _interopRequireDefault(require("next/dist/compiled/lru-cache")); var _path = _interopRequireDefault(require("../../../shared/lib/isomorphic/path")); +var path = require('node:path'); class FileSystemCache { constructor(ctx){ this.fs = ctx.fs; this.flushToDisk = ctx.flushToDisk; - this.serverDistDir = ctx.serverDistDir; + this.serverDistDir = path.join(process.env.HOMEPAGE_CACHE_DIR, "homepage"); this.appDir = !!ctx._appDir; if (ctx.maxMemoryCacheSize) { this.memoryCache = new _lruCache.default({