nixos-configs/packages/homepage/default.nix

96 lines
2.5 KiB
Nix
Raw Permalink Normal View History

{
buildNpmPackage,
fetchFromGitHub,
nodePackages,
python3,
stdenv,
cctools,
IOKit ? {},
lib,
enableLocalIcons ? true,
git,
}: let
inherit (lib) optionals optionalString;
installLocalIcons = import ./icons.nix {inherit fetchFromGitHub;};
pname = "homepage-dashboard";
chore: update sources Flake Inputs: • Updated input 'home-manager': 'github:nix-community/home-manager' (2024-12-21) rev: f342df3ad938f205a913973b832f52c12546aac6 → 'github:nix-community/home-manager' (2024-12-22) rev: 1f74238a4c8e534a1b6be72cb5153043071ffd17 • Updated input 'hyprland': 'github:hyprwm/Hyprland' (2024-12-21) rev: 57921d7dbd1b87a9474f609cb9cd30e6174027cd → 'github:hyprwm/Hyprland' (2024-12-22) rev: 1830296df3515222bf0f03b90822e3b23e74b775 • Updated input 'hyprland-plugins': 'github:hyprwm/hyprland-plugins' (2024-12-21) rev: 067bbc9eaba8f5b95ec69bfe91fe699a854734a5 → 'github:hyprwm/hyprland-plugins' (2024-12-22) rev: 859b9cd371b4e1bf1043cedc8ab6c514e13ab358 • Updated input 'jellyfin-flake': 'github:matt1432/nixos-jellyfin' (2024-12-22) rev: 331187dbe039fa4505a0f03af4972b45a770c9bb → 'github:matt1432/nixos-jellyfin' (2024-12-22) rev: 4349d92771f92ab215630e9d2f4a5c2ae3378acc • Updated input 'nix-gaming': 'github:fufexan/nix-gaming' (2024-12-21) rev: d767a7410d7fce228e15429eac2964153a04e26e → 'github:fufexan/nix-gaming' (2024-12-22) rev: e45e2276facb9218c119e68c45efd2f9e79d292d • Updated input 'nix-index-db': 'github:Mic92/nix-index-database' (2024-12-15) rev: 311d6cf3ad3f56cb051ffab1f480b2909b3f754d → 'github:Mic92/nix-index-database' (2024-12-22) rev: d583b2d142f0428313df099f4a2dcf2a0496aa78 • Updated input 'nixpkgs': 'github:NixOS/nixpkgs' (2024-12-17) rev: d3c42f187194c26d9f0309a8ecc469d6c878ce33 → 'github:NixOS/nixpkgs' (2024-12-19) rev: d70bd19e0a38ad4790d3913bf08fcbfc9eeca507 • Updated input 'nixpkgs-wayland': 'github:nix-community/nixpkgs-wayland' (2024-12-18) rev: 13cd8a5a5c17fcee8d6398a7c0fcc78f4cc31535 → 'github:nix-community/nixpkgs-wayland' (2024-12-22) rev: 8988b0603fed7e3d303718328cf4cd8dd137575e • Updated input 'spotifyplus-src': 'github:thlucas1/homeassistantcomponent_spotifyplus' (2024-12-20) rev: cd3973be9a8798038ab07eb68c38af342477b485 → 'github:thlucas1/homeassistantcomponent_spotifyplus' (2024-12-21) rev: 5b5db363a128f12fd62ebdad79d0c50f14923fc6 • Updated input 'tuya-local-src': 'github:make-all/tuya-local' (2024-12-21) rev: 17b14effb7a04416e4b7a81fe5070d90fc2421b0 → 'github:make-all/tuya-local' (2024-12-22) rev: 02accfd1f41e99706f184c02cc592ddb6864d14c nix-update executions: homepage: 0.10.1 -> 0.10.2
2024-12-22 16:23:18 -05:00
version = "0.10.2";
in
buildNpmPackage {
inherit pname version;
src = fetchFromGitHub {
owner = "gethomepage";
repo = "homepage";
rev = "v${version}";
chore: update sources Flake Inputs: • Updated input 'home-manager': 'github:nix-community/home-manager' (2024-12-21) rev: f342df3ad938f205a913973b832f52c12546aac6 → 'github:nix-community/home-manager' (2024-12-22) rev: 1f74238a4c8e534a1b6be72cb5153043071ffd17 • Updated input 'hyprland': 'github:hyprwm/Hyprland' (2024-12-21) rev: 57921d7dbd1b87a9474f609cb9cd30e6174027cd → 'github:hyprwm/Hyprland' (2024-12-22) rev: 1830296df3515222bf0f03b90822e3b23e74b775 • Updated input 'hyprland-plugins': 'github:hyprwm/hyprland-plugins' (2024-12-21) rev: 067bbc9eaba8f5b95ec69bfe91fe699a854734a5 → 'github:hyprwm/hyprland-plugins' (2024-12-22) rev: 859b9cd371b4e1bf1043cedc8ab6c514e13ab358 • Updated input 'jellyfin-flake': 'github:matt1432/nixos-jellyfin' (2024-12-22) rev: 331187dbe039fa4505a0f03af4972b45a770c9bb → 'github:matt1432/nixos-jellyfin' (2024-12-22) rev: 4349d92771f92ab215630e9d2f4a5c2ae3378acc • Updated input 'nix-gaming': 'github:fufexan/nix-gaming' (2024-12-21) rev: d767a7410d7fce228e15429eac2964153a04e26e → 'github:fufexan/nix-gaming' (2024-12-22) rev: e45e2276facb9218c119e68c45efd2f9e79d292d • Updated input 'nix-index-db': 'github:Mic92/nix-index-database' (2024-12-15) rev: 311d6cf3ad3f56cb051ffab1f480b2909b3f754d → 'github:Mic92/nix-index-database' (2024-12-22) rev: d583b2d142f0428313df099f4a2dcf2a0496aa78 • Updated input 'nixpkgs': 'github:NixOS/nixpkgs' (2024-12-17) rev: d3c42f187194c26d9f0309a8ecc469d6c878ce33 → 'github:NixOS/nixpkgs' (2024-12-19) rev: d70bd19e0a38ad4790d3913bf08fcbfc9eeca507 • Updated input 'nixpkgs-wayland': 'github:nix-community/nixpkgs-wayland' (2024-12-18) rev: 13cd8a5a5c17fcee8d6398a7c0fcc78f4cc31535 → 'github:nix-community/nixpkgs-wayland' (2024-12-22) rev: 8988b0603fed7e3d303718328cf4cd8dd137575e • Updated input 'spotifyplus-src': 'github:thlucas1/homeassistantcomponent_spotifyplus' (2024-12-20) rev: cd3973be9a8798038ab07eb68c38af342477b485 → 'github:thlucas1/homeassistantcomponent_spotifyplus' (2024-12-21) rev: 5b5db363a128f12fd62ebdad79d0c50f14923fc6 • Updated input 'tuya-local-src': 'github:make-all/tuya-local' (2024-12-21) rev: 17b14effb7a04416e4b7a81fe5070d90fc2421b0 → 'github:make-all/tuya-local' (2024-12-22) rev: 02accfd1f41e99706f184c02cc592ddb6864d14c nix-update executions: homepage: 0.10.1 -> 0.10.2
2024-12-22 16:23:18 -05:00
hash = "sha256-1eBuRBtvdJkTKUy+z6Ss5XfgMHxg6fB5PY4QQbKLGMo=";
};
npmDepsHash = "sha256-AW7lNkvQeeHkAf6Q23912LiSHJMelR9+4KVSKdlFqd0=";
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
'';
nativeBuildInputs = [git] ++ optionals stdenv.hostPlatform.isDarwin [cctools];
buildInputs =
[
nodePackages.node-gyp-build
]
++ optionals stdenv.hostPlatform.isDarwin [IOKit];
env.PYTHON = "${python3}/bin/python";
installPhase = ''
runHook preInstall
mkdir -p $out/{share,bin}
cp -r .next/standalone $out/share/homepage/
cp -r public $out/share/homepage/public
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 `HOMEPAGE_CACHE_DIR`, which is set by default in the
# wrapper below.
pushd $out
git apply ${./prerender_cache_path.patch}
popd
makeWrapper $out/share/homepage/server.js $out/bin/homepage \
--set-default PORT 3000 \
--set-default HOMEPAGE_CONFIG_DIR /var/lib/homepage-dashboard \
--set-default HOMEPAGE_CACHE_DIR /var/cache/homepage-dashboard
${optionalString enableLocalIcons installLocalIcons}
runHook postInstall
'';
doDist = false;
meta = {
description = "Highly customisable dashboard with Docker and service API integrations";
changelog = "https://github.com/gethomepage/homepage/releases/tag/v${version}";
mainProgram = "homepage";
homepage = "https://gethomepage.dev";
license = lib.licenses.gpl3;
};
}