11 enableLocalIcons ? false,
16 dashboardIcons = fetchFromGitHub {
18 repo = "dashboard-icons";
19 rev = "be82e22c418f5980ee2a13064d50f1483df39c8c"; # Until 2024-07-21
20 hash = "sha256-z69DKzKhCVNnNHjRM3dX/DD+WJOL9wm1Im1nImhBc9Y=";
23 installLocalIcons = ''
24 mkdir -p $out/share/homepage/public/icons
25 cp ${dashboardIcons}/png/* $out/share/homepage/public/icons
26 cp ${dashboardIcons}/svg/* $out/share/homepage/public/icons
27 cp ${dashboardIcons}/LICENSE $out/share/homepage/public/icons/
31 pname = "homepage-dashboard";
34 src = fetchFromGitHub {
35 owner = "gethomepage";
38 hash = "sha256-qDbYgitMbjOMIZUyQuFSNAyb/ZRAcStm/jDrsIutKno=";
41 npmDepsHash = "sha256-gAti4y4Ios7XjJ3nVOhzjwPzcAC2upODZ64qQjx17JE=";
48 # Add a shebang to the server js file, then patch the shebang.
49 sed -i '1s|^|#!/usr/bin/env node\n|' .next/standalone/server.js
50 patchShebangs .next/standalone/server.js
53 nativeBuildInputs = [ git ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ cctools ];
56 nodePackages.node-gyp-build
57 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ IOKit ];
59 env.PYTHON = "${python3}/bin/python";
64 mkdir -p $out/{share,bin}
66 cp -r .next/standalone $out/share/homepage/
67 cp -r public $out/share/homepage/public
69 mkdir -p $out/share/homepage/.next
70 cp -r .next/static $out/share/homepage/.next/static
72 chmod +x $out/share/homepage/server.js
74 # This patch must be applied here, as it's patching the `dist` directory
75 # of NextJS. Without this, homepage-dashboard errors when trying to
76 # write its prerender cache.
78 # This patch ensures that the cache implementation respects the env
79 # variable `HOMEPAGE_CACHE_DIR`, which is set by default in the
82 git apply ${./prerender_cache_path.patch}
85 makeWrapper $out/share/homepage/server.js $out/bin/homepage \
86 --set-default PORT 3000 \
87 --set-default HOMEPAGE_CONFIG_DIR /var/lib/homepage-dashboard \
88 --set-default HOMEPAGE_CACHE_DIR /var/cache/homepage-dashboard
90 ${if enableLocalIcons then installLocalIcons else ""}
99 inherit (nixosTests) homepage-dashboard;
101 updateScript = nix-update-script { };
105 description = "Highly customisable dashboard with Docker and service API integrations";
106 changelog = "https://github.com/gethomepage/homepage/releases/tag/v${version}";
107 mainProgram = "homepage";
108 homepage = "https://gethomepage.dev";
109 license = lib.licenses.gpl3;
110 maintainers = with lib.maintainers; [ jnsgruk ];
111 platforms = lib.platforms.all;
112 broken = stdenv.hostPlatform.isDarwin;