homepage-dashboard: 0.10.9 -> 1.0.4
This commit bumps homepage-dashboard to 1.0.4, but also introduces a different build method. The upstream project uses pnpm, and no longer ships a package.json, so it's easiest for us to follow and use pnpm. In this commit, we move to building with pnpm, but also need to change the patching methodology. pnpm has the ability to carry patches locally against dependencies, but it also hashes the patch and checks the hash before build, which means the patch will need to be updated each time to include the change to package.json, pnpm-lock.yaml and the actual file changed. In a later commit, I'll introduce an update script to do this automatically.
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
{
|
||||
buildNpmPackage,
|
||||
fetchFromGitHub,
|
||||
nodePackages,
|
||||
makeWrapper,
|
||||
nodejs,
|
||||
pnpm_10,
|
||||
python3,
|
||||
stdenv,
|
||||
cctools,
|
||||
@@ -26,30 +28,37 @@ let
|
||||
cp ${dashboardIcons}/LICENSE $out/share/homepage/public/icons/
|
||||
'';
|
||||
in
|
||||
buildNpmPackage rec {
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "homepage-dashboard";
|
||||
version = "0.10.9";
|
||||
version = "1.0.4";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "gethomepage";
|
||||
repo = "homepage";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-q8+uoikHMQVuTrVSH8tPsoI5655ZStMc/7tmoAfoZIY=";
|
||||
rev = "v${finalAttrs.version}";
|
||||
hash = "sha256-7fi7cW+DKjU9CeVEg863UGwCqTXxA1UrwlK2vrx1c5w=";
|
||||
};
|
||||
|
||||
npmDepsHash = "sha256-N39gwct2U4UxlIL5ceDzzU7HpA6xh2WksrZNxGz04PU=";
|
||||
# This patch ensures that the cache implementation respects the env
|
||||
# variable `NIXPKGS_HOMEPAGE_CACHE_DIR`, which is set by default in the
|
||||
# wrapper below.
|
||||
patches = [ ./prerender_cache_path.patch ];
|
||||
|
||||
preBuild = ''
|
||||
mkdir -p config
|
||||
'';
|
||||
pnpmDeps = pnpm_10.fetchDeps {
|
||||
inherit (finalAttrs)
|
||||
pname
|
||||
version
|
||||
src
|
||||
patches
|
||||
;
|
||||
hash = "sha256-E16+JLtfoiWCXwgFGdTGuFlx/pYxhINNl6tCuF9Z6MQ=";
|
||||
};
|
||||
|
||||
postBuild = ''
|
||||
# Add a shebang to the server js file, then patch the shebang.
|
||||
sed -i '1s|^|#!/usr/bin/env node\n|' .next/standalone/server.js
|
||||
patchShebangs .next/standalone/server.js
|
||||
'';
|
||||
|
||||
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ cctools ];
|
||||
nativeBuildInputs = [
|
||||
makeWrapper
|
||||
nodejs
|
||||
pnpm_10.configHook
|
||||
] ++ lib.optionals stdenv.hostPlatform.isDarwin [ cctools ];
|
||||
|
||||
buildInputs = [
|
||||
nodePackages.node-gyp-build
|
||||
@@ -57,32 +66,29 @@ buildNpmPackage rec {
|
||||
|
||||
env.PYTHON = "${python3}/bin/python";
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
mkdir -p config
|
||||
pnpm build
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/{share,bin}
|
||||
|
||||
mkdir -p $out/{bin,share}
|
||||
cp -r .next/standalone $out/share/homepage/
|
||||
cp -r public $out/share/homepage/public
|
||||
chmod +x $out/share/homepage/server.js
|
||||
|
||||
mkdir -p $out/share/homepage/.next
|
||||
cp -r .next/static $out/share/homepage/.next/static
|
||||
|
||||
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 `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 \
|
||||
makeWrapper "${lib.getExe nodejs}" $out/bin/homepage \
|
||||
--set-default PORT 3000 \
|
||||
--set-default HOMEPAGE_CONFIG_DIR /var/lib/homepage-dashboard \
|
||||
--set-default NIXPKGS_HOMEPAGE_CACHE_DIR /var/cache/homepage-dashboard
|
||||
--set-default NIXPKGS_HOMEPAGE_CACHE_DIR /var/cache/homepage-dashboard \
|
||||
--add-flags "$out/share/homepage/server.js"
|
||||
|
||||
${if enableLocalIcons then installLocalIcons else ""}
|
||||
|
||||
@@ -100,7 +106,7 @@ buildNpmPackage rec {
|
||||
|
||||
meta = {
|
||||
description = "Highly customisable dashboard with Docker and service API integrations";
|
||||
changelog = "https://github.com/gethomepage/homepage/releases/tag/v${version}";
|
||||
changelog = "https://github.com/gethomepage/homepage/releases/tag/v${finalAttrs.version}";
|
||||
mainProgram = "homepage";
|
||||
homepage = "https://gethomepage.dev";
|
||||
license = lib.licenses.gpl3;
|
||||
@@ -108,4 +114,4 @@ buildNpmPackage rec {
|
||||
platforms = lib.platforms.all;
|
||||
broken = stdenv.hostPlatform.isDarwin;
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,18 +1,89 @@
|
||||
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.NIXPKGS_HOMEPAGE_CACHE_DIR, "homepage");
|
||||
this.appDir = !!ctx._appDir;
|
||||
if (ctx.maxMemoryCacheSize) {
|
||||
this.memoryCache = new _lruCache.default({
|
||||
diff --git c/package.json i/package.json
|
||||
index 44fc1b35..4164abf3 100644
|
||||
--- c/package.json
|
||||
+++ i/package.json
|
||||
@@ -62,5 +62,10 @@
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"osx-temperature-sensor": "^1.0.8"
|
||||
+ },
|
||||
+ "pnpm": {
|
||||
+ "patchedDependencies": {
|
||||
+ "next": "patches/next.patch"
|
||||
+ }
|
||||
}
|
||||
}
|
||||
diff --git c/patches/next.patch i/patches/next.patch
|
||||
new file mode 100644
|
||||
index 00000000..6280dbfa
|
||||
--- /dev/null
|
||||
+++ i/patches/next.patch
|
||||
@@ -0,0 +1,13 @@
|
||||
+diff --git a/dist/server/lib/incremental-cache/file-system-cache.js b/dist/server/lib/incremental-cache/file-system-cache.js
|
||||
+index ac711f168d85032d43cfa2b6872655d571596a7b..ee1f79868d38ae623b0599e8cc3b9e03697833e5 100644
|
||||
+--- a/dist/server/lib/incremental-cache/file-system-cache.js
|
||||
++++ b/dist/server/lib/incremental-cache/file-system-cache.js
|
||||
+@@ -23,7 +23,7 @@ class FileSystemCache {
|
||||
+ constructor(ctx){
|
||||
+ this.fs = ctx.fs;
|
||||
+ this.flushToDisk = ctx.flushToDisk;
|
||||
+- this.serverDistDir = ctx.serverDistDir;
|
||||
++ this.serverDistDir = require("path").join((process.env.NIXPKGS_HOMEPAGE_CACHE_DIR || "/var/cache/homepage-dashboard"), "homepage");
|
||||
+ this.revalidatedTags = ctx.revalidatedTags;
|
||||
+ this.debug = !!process.env.NEXT_PRIVATE_DEBUG_CACHE;
|
||||
+ if (ctx.maxMemoryCacheSize) {
|
||||
diff --git c/pnpm-lock.yaml i/pnpm-lock.yaml
|
||||
index 6b5c5910..84712cd2 100644
|
||||
--- c/pnpm-lock.yaml
|
||||
+++ i/pnpm-lock.yaml
|
||||
@@ -4,6 +4,11 @@ settings:
|
||||
autoInstallPeers: true
|
||||
excludeLinksFromLockfile: false
|
||||
|
||||
+patchedDependencies:
|
||||
+ next:
|
||||
+ hash: 2cf73b70a6661c14b83ebd01d193260f13fcc654e74e5658ffc191f538863a49
|
||||
+ path: patches/next.patch
|
||||
+
|
||||
importers:
|
||||
|
||||
.:
|
||||
@@ -52,10 +57,10 @@ importers:
|
||||
version: 1.2.2
|
||||
next:
|
||||
specifier: ^15.1.7
|
||||
- version: 15.1.7(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||
+ version: 15.1.7(patch_hash=2cf73b70a6661c14b83ebd01d193260f13fcc654e74e5658ffc191f538863a49)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||
next-i18next:
|
||||
specifier: ^12.1.0
|
||||
- version: 12.1.0(next@15.1.7(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||
+ version: 12.1.0(next@15.1.7(patch_hash=2cf73b70a6661c14b83ebd01d193260f13fcc654e74e5658ffc191f538863a49)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||
ping:
|
||||
specifier: ^0.4.4
|
||||
version: 0.4.4
|
||||
@@ -4688,7 +4693,7 @@ snapshots:
|
||||
|
||||
natural-compare@1.4.0: {}
|
||||
|
||||
- next-i18next@12.1.0(next@15.1.7(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1):
|
||||
+ next-i18next@12.1.0(next@15.1.7(patch_hash=2cf73b70a6661c14b83ebd01d193260f13fcc654e74e5658ffc191f538863a49)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1):
|
||||
dependencies:
|
||||
'@babel/runtime': 7.26.9
|
||||
'@types/hoist-non-react-statics': 3.3.6
|
||||
@@ -4696,14 +4701,14 @@ snapshots:
|
||||
hoist-non-react-statics: 3.3.2
|
||||
i18next: 21.10.0
|
||||
i18next-fs-backend: 1.2.0
|
||||
- next: 15.1.7(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||
+ next: 15.1.7(patch_hash=2cf73b70a6661c14b83ebd01d193260f13fcc654e74e5658ffc191f538863a49)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||
react: 18.3.1
|
||||
react-i18next: 11.18.6(i18next@21.10.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||
transitivePeerDependencies:
|
||||
- react-dom
|
||||
- react-native
|
||||
|
||||
- next@15.1.7(react-dom@18.3.1(react@18.3.1))(react@18.3.1):
|
||||
+ next@15.1.7(patch_hash=2cf73b70a6661c14b83ebd01d193260f13fcc654e74e5658ffc191f538863a49)(react-dom@18.3.1(react@18.3.1))(react@18.3.1):
|
||||
dependencies:
|
||||
'@next/env': 15.1.7
|
||||
'@swc/counter': 0.1.3
|
||||
|
||||
Reference in New Issue
Block a user