From be0fda65110b123a09313ca03d087a16a63276ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Sun, 5 Jan 2025 21:23:34 +0100 Subject: [PATCH] homepage-dashboard: prefix nixpkgs-specific env var with NIXPKGS_ I thought HOMEPAGE_CACHE_DIR was an upstream env var, and it confused me a lot. Let's prefix it with NIXPKGS_ to make it clear that it's nixpkgs specific. --- nixos/modules/services/misc/homepage-dashboard.nix | 2 +- pkgs/servers/homepage-dashboard/default.nix | 4 ++-- pkgs/servers/homepage-dashboard/prerender_cache_path.patch | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nixos/modules/services/misc/homepage-dashboard.nix b/nixos/modules/services/misc/homepage-dashboard.nix index 612a88ed48b5..a4e5b8d2fc8c 100644 --- a/nixos/modules/services/misc/homepage-dashboard.nix +++ b/nixos/modules/services/misc/homepage-dashboard.nix @@ -240,7 +240,7 @@ in environment = { HOMEPAGE_CONFIG_DIR = configDir; - HOMEPAGE_CACHE_DIR = "/var/cache/homepage-dashboard"; + NIXPKGS_HOMEPAGE_CACHE_DIR = "/var/cache/homepage-dashboard"; PORT = toString cfg.listenPort; LOG_TARGETS = lib.mkIf managedConfig "stdout"; }; diff --git a/pkgs/servers/homepage-dashboard/default.nix b/pkgs/servers/homepage-dashboard/default.nix index f586ede472df..c316faf358f0 100644 --- a/pkgs/servers/homepage-dashboard/default.nix +++ b/pkgs/servers/homepage-dashboard/default.nix @@ -76,14 +76,14 @@ buildNpmPackage rec { # 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 + # variable `NIXPKGS_HOMEPAGE_CACHE_DIR`, which is set by default in the # wrapper below. (cd "$out" && patch -p1 <${./prerender_cache_path.patch}) 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_CACHE_DIR /var/cache/homepage-dashboard + --set-default NIXPKGS_HOMEPAGE_CACHE_DIR /var/cache/homepage-dashboard ${if enableLocalIcons then installLocalIcons else ""} diff --git a/pkgs/servers/homepage-dashboard/prerender_cache_path.patch b/pkgs/servers/homepage-dashboard/prerender_cache_path.patch index 05746b5601c4..1d8c3b34384a 100644 --- a/pkgs/servers/homepage-dashboard/prerender_cache_path.patch +++ b/pkgs/servers/homepage-dashboard/prerender_cache_path.patch @@ -12,7 +12,7 @@ index b1b74d8..a46c80b 100644 this.fs = ctx.fs; this.flushToDisk = ctx.flushToDisk; - this.serverDistDir = ctx.serverDistDir; -+ this.serverDistDir = path.join(process.env.HOMEPAGE_CACHE_DIR, "homepage"); ++ this.serverDistDir = path.join(process.env.NIXPKGS_HOMEPAGE_CACHE_DIR, "homepage"); this.appDir = !!ctx._appDir; if (ctx.maxMemoryCacheSize) { this.memoryCache = new _lruCache.default({