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
|
|
|
|
, nixosTests
|
2024-02-29 20:09:43 +00:00
|
|
|
, enableLocalIcons ? false
|
2024-04-21 15:54:59 +00:00
|
|
|
, nix-update-script
|
2023-07-15 17:15:38 +00:00
|
|
|
}:
|
2024-02-29 20:09:43 +00:00
|
|
|
let
|
|
|
|
dashboardIcons = fetchFromGitHub {
|
|
|
|
owner = "walkxcode";
|
|
|
|
repo = "dashboard-icons";
|
|
|
|
rev = "a02a5999fe56948671721da8b0830cdd5b609ed7"; # Until 2024-02-25
|
|
|
|
hash = "sha256-s0Doh4j6CH66fZoQKMt4yc7aLStNFGMVoDp5dvs7+pk=";
|
|
|
|
};
|
2023-07-15 17:15:38 +00:00
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
installLocalIcons = ''
|
|
|
|
mkdir -p $out/share/homepage/public/icons
|
|
|
|
cp ${dashboardIcons}/png/* $out/share/homepage/public/icons
|
|
|
|
cp ${dashboardIcons}/svg/* $out/share/homepage/public/icons
|
|
|
|
cp ${dashboardIcons}/LICENSE $out/share/homepage/public/icons/
|
|
|
|
'';
|
|
|
|
in
|
2023-07-15 17:15:38 +00:00
|
|
|
buildNpmPackage rec {
|
|
|
|
pname = "homepage-dashboard";
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "0.9.5";
|
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}";
|
2024-07-27 06:49:29 +00:00
|
|
|
hash = "sha256-j5DGi5bLoUOoeu8RupiN+qeixNcpPAu3XG4PidZ5Bsg=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
npmDepsHash = "sha256-jYZUVwrOxoAbfHHSBkN5IlYhC6yZVVwRoZErkbYrjUs=";
|
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
|
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
mkdir -p $out/{share,bin}
|
2023-07-15 17:15:38 +00:00
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
cp -r .next/standalone $out/share/homepage/
|
|
|
|
cp -r public $out/share/homepage/public
|
2023-07-15 17:15:38 +00:00
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
mkdir -p $out/share/homepage/.next
|
|
|
|
cp -r .next/static $out/share/homepage/.next/static
|
2023-07-15 17:15:38 +00:00
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
chmod +x $out/share/homepage/server.js
|
|
|
|
|
|
|
|
makeWrapper $out/share/homepage/server.js $out/bin/homepage \
|
2023-07-15 17:15:38 +00:00
|
|
|
--set-default PORT 3000 \
|
|
|
|
--set-default HOMEPAGE_CONFIG_DIR /var/lib/homepage-dashboard
|
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
${if enableLocalIcons then installLocalIcons else ""}
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
doDist = false;
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
passthru = {
|
|
|
|
tests = {
|
|
|
|
inherit (nixosTests) homepage-dashboard;
|
|
|
|
};
|
|
|
|
updateScript = nix-update-script { };
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
meta = {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Highly customisable dashboard with Docker and service API integrations";
|
2024-04-21 15:54:59 +00:00
|
|
|
changelog = "https://github.com/gethomepage/homepage/releases/tag/v${version}";
|
2023-07-15 17:15:38 +00:00
|
|
|
mainProgram = "homepage";
|
|
|
|
homepage = "https://gethomepage.dev";
|
|
|
|
license = lib.licenses.gpl3;
|
|
|
|
maintainers = with lib.maintainers; [ jnsgruk ];
|
|
|
|
platforms = lib.platforms.all;
|
2024-01-02 11:29:13 +00:00
|
|
|
broken = stdenv.isDarwin;
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
}
|