2023-07-15 17:15:38 +00:00
|
|
|
{ buildNpmPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, nodePackages
|
|
|
|
, python3
|
2023-08-04 22:07:22 +00:00
|
|
|
, stdenv
|
|
|
|
, cctools
|
|
|
|
, IOKit
|
2023-07-15 17:15:38 +00:00
|
|
|
, lib
|
|
|
|
, fetchpatch
|
|
|
|
, makeBinaryWrapper
|
|
|
|
, nixosTests
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildNpmPackage rec {
|
|
|
|
pname = "homepage-dashboard";
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "0.7.2";
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2023-10-09 19:29:22 +00:00
|
|
|
owner = "gethomepage";
|
2023-07-15 17:15:38 +00:00
|
|
|
repo = "homepage";
|
|
|
|
rev = "v${version}";
|
2023-10-09 19:29:22 +00:00
|
|
|
hash = "sha256-p2h1XPVMTZ23nxu/rX/qOQ5DXOZ0ORaXR41ng4pgmmg=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
npmDepsHash = "sha256-ZUdBXkQnwh0jrrSKukHeSv3HS1q24Qd12zVnpV71qIY=";
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
mkdir -p config
|
|
|
|
'';
|
|
|
|
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
nativeBuildInputs = lib.optionals stdenv.isDarwin [
|
|
|
|
cctools
|
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
buildInputs = [
|
|
|
|
nodePackages.node-gyp-build
|
2023-08-04 22:07:22 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
IOKit
|
2023-07-15 17:15:38 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
env.PYTHON = "${python3}/bin/python";
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p $out
|
|
|
|
cp -r .next/standalone $out/bin
|
|
|
|
cp -r public $out/bin/public
|
|
|
|
|
|
|
|
mkdir -p $out/bin/.next
|
|
|
|
cp -r .next/static $out/bin/.next/static
|
|
|
|
|
|
|
|
mv $out/bin/server.js $out/bin/homepage
|
|
|
|
chmod +x $out/bin/homepage
|
|
|
|
|
|
|
|
wrapProgram $out/bin/homepage \
|
|
|
|
--set-default PORT 3000 \
|
|
|
|
--set-default HOMEPAGE_CONFIG_DIR /var/lib/homepage-dashboard
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
doDist = false;
|
|
|
|
|
|
|
|
passthru.tests = {
|
2023-08-04 22:07:22 +00:00
|
|
|
inherit (nixosTests) homepage-dashboard;
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "A highly customisable dashboard with Docker and service API integrations.";
|
|
|
|
mainProgram = "homepage";
|
|
|
|
homepage = "https://gethomepage.dev";
|
|
|
|
license = lib.licenses.gpl3;
|
|
|
|
maintainers = with lib.maintainers; [ jnsgruk ];
|
|
|
|
platforms = lib.platforms.all;
|
|
|
|
};
|
|
|
|
}
|