nixpkgs/pkgs/servers/homepage-dashboard/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

85 lines
1.8 KiB
Nix
Raw Normal View History

2023-07-12 18:37:15 +03:00
{ buildNpmPackage
, fetchFromGitHub
, nodePackages
, python3
2023-07-20 10:43:25 +03:00
, stdenv
, cctools
, IOKit
2023-07-12 18:37:15 +03:00
, lib
, fetchpatch
, makeBinaryWrapper
, nixosTests
}:
buildNpmPackage rec {
pname = "homepage-dashboard";
2024-02-14 07:57:58 +03:00
version = "0.8.8";
2023-07-12 18:37:15 +03:00
src = fetchFromGitHub {
2023-10-05 11:14:12 +03:00
owner = "gethomepage";
2023-07-12 18:37:15 +03:00
repo = "homepage";
rev = "v${version}";
2024-02-14 07:57:58 +03:00
hash = "sha256-QPMjf+VpsjvIrjjhDuZqd8VLl2Uu5Wop286Yn8XeRWk=";
2023-07-12 18:37:15 +03:00
};
2024-02-14 07:57:58 +03:00
npmDepsHash = "sha256-u15lDdXnV3xlXAC9WQQKLIeV/AgtRM1sFNsacw3j6kU=";
2023-07-12 18:37:15 +03: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-07-20 10:43:25 +03:00
nativeBuildInputs = lib.optionals stdenv.isDarwin [
cctools
];
2023-07-12 18:37:15 +03:00
buildInputs = [
nodePackages.node-gyp-build
2023-07-20 10:43:25 +03:00
] ++ lib.optionals stdenv.isDarwin [
IOKit
2023-07-12 18:37:15 +03: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-07-20 10:43:25 +03:00
inherit (nixosTests) homepage-dashboard;
2023-07-12 18:37:15 +03: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;
broken = stdenv.isDarwin;
2023-07-12 18:37:15 +03:00
};
}