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

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

84 lines
1.7 KiB
Nix
Raw Normal View History

2023-07-12 15:37:15 +00:00
{ buildNpmPackage
, fetchFromGitHub
, nodePackages
, python3
2023-07-20 07:43:25 +00:00
, stdenv
, cctools
, IOKit
2023-07-12 15:37:15 +00:00
, lib
, fetchpatch
, makeBinaryWrapper
, nixosTests
}:
buildNpmPackage rec {
pname = "homepage-dashboard";
2023-07-20 07:43:25 +00:00
version = "0.6.23";
2023-07-12 15:37:15 +00:00
src = fetchFromGitHub {
owner = "benphelps";
repo = "homepage";
rev = "v${version}";
2023-07-20 07:43:25 +00:00
hash = "sha256-Nr090221lTW7luuzh/URdDPByILnjMChyZcV2+AUG3o=";
2023-07-12 15:37:15 +00:00
};
2023-07-20 07:43:25 +00:00
npmDepsHash = "sha256-l6kVmKXAQMqpzu/GTrz92WeDorLhunfcUrbMVfUwR9U=";
2023-07-12 15:37:15 +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-07-20 07:43:25 +00:00
nativeBuildInputs = lib.optionals stdenv.isDarwin [
cctools
];
2023-07-12 15:37:15 +00:00
buildInputs = [
nodePackages.node-gyp-build
2023-07-20 07:43:25 +00:00
] ++ lib.optionals stdenv.isDarwin [
IOKit
2023-07-12 15:37:15 +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-07-20 07:43:25 +00:00
inherit (nixosTests) homepage-dashboard;
2023-07-12 15:37:15 +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;
};
}